Skip to content

Instantly share code, notes, and snippets.

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

Dmitriy Krivoshein kdes70

🏠
Working from home
View GitHub Profile
@kdes70
kdes70 / gist:17856cb86672be1af1ac
Created November 23, 2015 09:36
array_column
<?php
if (!function_exists('array_column')) {
function array_column(array $array, $columnKey, $indexKey = null)
{
$result = array();
foreach ($array as $subArray) {
if (!is_array($subArray)) {
continue;
} elseif (is_null($indexKey) && array_key_exists($columnKey, $subArray)) {
$result[] = $subArray[$columnKey];
document.getElementById('google_preview').innerHTML = '<span class="google_preview_title">' + document.getElementById('theme_metatitle').value + '</span><br/><span class="google_preview_seo_url">'+ domain_name_short + script_url + seo_url + '</span><br/><span class="google_preview_page_description">'+ document.getElementById('theme_metadescription').value+'</span>';
var img_id = 'google_preview_img';
if(typeof jQuery('#'+img_id).data('qtip') == 'object')
{
var api = jQuery('#'+img_id).qtip("api");
change_google_preview();
}
else
{
jQuery('#'+img_id).qtip({
@kdes70
kdes70 / gist:3fe5ad604f9be928201f
Created July 16, 2015 16:54
Yii2 Рендер категорий выподающем списке в виде дерева
<?=$form->field($offer, 'categories_list')->dropDownList(
ArrayHelper::map($categories,'id',function($value){ return str_repeat('-',count(explode('.',$value->path) )) . $value->name ;} ),
['multiple' => true]);
?>
/**
* Подстовляем дефис в интервал десятичных чисел
* *1, 1.2, 1.3, 1.4, 2, 3 => result 1-1.4, 2, 3*
*
* @param $array
* @param bool $str если TRUE возврощать будет страку
*
* @return array|string
*/
public static function spacing($array, $str = FALSE)
@kdes70
kdes70 / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console