Skip to content

Instantly share code, notes, and snippets.

View Kcko's full-sized avatar
🦜
fly like a bird ...

Roman Janko Kcko

🦜
fly like a bird ...
View GitHub Profile
@Kcko
Kcko / predlozky.php
Created February 18, 2017 07:36
Filter do Latte
<?php
public static function predlozky($string) {
/*
$string = preg_replace('~ ([akosvzAKOSVZ]) ~', ' $1&nbsp;', $string);
$string = preg_replace('~^([AKOSVZ]) ~', ' $1&nbsp;', $string);
return $string;
@Kcko
Kcko / czech-sort.php
Created February 18, 2017 15:00
czech sort in array
<?php
function SortCzechChars($a, $b){
static $czechCharsS = array('Á', 'Č', 'Ď', 'É', 'Ě' , 'Ch' , 'Í', 'Ň', 'Ó', 'Ř', 'Š', 'Ť', 'Ú', 'Ů' , 'Ý', 'Ž', 'á', 'č', 'ď', 'é', 'ě' , 'ch' , 'í', 'ň', 'ó', 'ř', 'š', 'ť', 'ú', 'ů' , 'ý', 'ž');
static $czechCharsR = array('AZ','CZ','DZ','EZ','EZZ','HZZZ','IZ','NZ','OZ','RZ','SZ','TZ','UZ','UZZ','YZ','ZZ','az','cz','dz','ez','ezz','hzzz','iz','nz','oz','rz','sz','tz','uz','uzz','yz','zz');
$A = str_replace($czechCharsS, $czechCharsR, $a);
$B = str_replace($czechCharsS, $czechCharsR, $b);
return strnatcasecmp($A, $B);
// Define your locations: HTML content for the info window, latitude, longitude
var locations = [
['<div id="iw-container"><div class="iw-title">EKOCITY Hostivař</div><img src="http://www.ekospol.cz/assets/ekospol/ekocity_hostivar/vizualizace/4.jpg" alt="EKOCITY Hostivař" width="100%"><div class="iw-content"><a href="http://www.ekospol.cz/byty/prodej-bytu-praha/ekocity-hostivar/" class="button block-button primary" >Detail projektu</a></div></div>', 50.057417, 14.541753],
['<div id="iw-container"><div class="iw-title">Výhledy Barrandov</div><img src="http://www.ekospol.cz/assets/ekospol/vyhledy_barrandov/vyhledy-barrandov-viz.jpg" alt="Výhledy Barrandov" width="100%"><div class="iw-content"><a href="http://www.ekospol.cz/byty/prodej-bytu-praha/barrandov/" class="button block-button primary" >Detail projektu</a></div></div>', 50.031184, 14.362346],
['<div id="iw-container"><div class="iw-title">Panorama Kyje VIII</div><img src="http://www.ekospol.cz/assets/ekospol/panorama_kyje_viii/panor
function timeout(milliseconds) {
// Create a new Deferred object
var deferred = $.Deferred();
// Resolve the Deferred after the amount of time specified by milliseconds
setTimeout(deferred.resolve, milliseconds);
// Return the Deferred's Promise object
return deferred.promise();
}
@Kcko
Kcko / gist:b02e1586ceb9c2af4d41c770fc4620d9
Created February 22, 2017 19:35 — forked from grandmanitou/gist:8863248
Place multiple markers with infowindow on Google Maps API v3, use external links to trigger click and center map on desired location.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language=fra&amp;sensor=false"></script>
<script type="text/javascript">
var map;
var Markers = {};
var infowindow;
var locations = [
[
'Samsung Store Madeleine',
'<strong>Samsung Store Madeleine</strong><p>5 Boulevard Malesherbes, 75008 Paris<br>10h – 20h</p>',
48.8701925,
@Kcko
Kcko / flatten.php
Created February 26, 2017 09:27 — forked from kohnmd/flatten.php
Function to recursively flatten multidimensional PHP array.
<?php
// Requires PHP 5.3+
// Found here: http://stackoverflow.com/a/1320156
function flatten_array(array $array) {
$flattened_array = array();
array_walk_recursive($array, function($a) use (&$flattened_array) { $flattened_array[] = $a; });
return $flattened_array;
}
@Kcko
Kcko / jquery-pub-sub.md
Last active January 29, 2019 19:23 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.

This is now an actual repo:

https://github.com/cowboy/jquery-tiny-pubsub

This is the Original jQuery Tiny Pub/Sub plugin updated for jQuery 1.7 (which makes it EVEN SMALLER because bind and unbind are replaced with on and off)

Note: Ignore the first argument passed to your subscribed callbacks (the jQuery event object).

Another Note: Previous versions (v0.4+) were written in an attempt to remove the first argument and create a more future-proof API, but unfortunately this resulted in much less elegant, larger and slower code. The point of this plugin is to be TINY, to be used in situations where only size (not performance or usability) is the primary concern (tweets, code golf, etc).**

@Kcko
Kcko / prunik-hranice.sql
Created March 16, 2017 13:29
Prunik datumů - hranice
select
*
from
rezervation_repeatedly
where
date_from <= '$week_end'
and date_to >= '$week_start'
order by
id asc
@Kcko
Kcko / style.css
Created March 21, 2017 10:16
Jquery - řazení tabulky - tablesorter demo - https://jsfiddle.net/bmfz1pau/
.focus {
background-color: #ff00ff;
color: #fff;
cursor: pointer;
font-weight: bold;
}
.selected {
background-color: #ff00ff;
color: #fff;
@Kcko
Kcko / SCSS.md
Created April 6, 2017 19:39 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso