Skip to content

Instantly share code, notes, and snippets.

View karneds's full-sized avatar
🏠
Working from home

karneds karneds

🏠
Working from home
  • Russia, Yaroslavl
View GitHub Profile
<?php
public function getPreview($width = null, $height = null)
{
if ($this->preview) {
if ($height && $width) {
return preg_replace('#\%2F#i', '/', Url::to(['/thumbs/index', 'file' => $this->preview, 'width' => $width, 'height' => $height]));
}
return '/uploads/' . $this->preview;
}
return;
@karneds
karneds / gist:262418c8e8647e035c25
Created July 17, 2014 14:20
Jquery autocomplete from yandex maps api
$('#address').autocomplete({
source: function( request, response ) {
$.getJSON("http://geocode-maps.yandex.ru/1.x/?",{
format: "json",
geocode:request.term
}).done(function( data ) {
var addresses = [];
$.each(data.response.GeoObjectCollection.featureMember, function(i,item) {
addresses.push(item.GeoObject.name);
//addresses.push(item.GeoObject.metaDataProperty.GeocoderMetaData.text); full address