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 / event.js
Last active August 29, 2015 14:17 — forked from branneman/event.js
$(function() {
var resizeEnd;
$(window).on('resize', function() {
clearTimeout(resizeEnd);
resizeEnd = setTimeout(function() {
$(window).trigger('resizeEnd');
<?php
function fillMyArr($from, $to)
{
for ($i = $from; $i <= $to; $i++)
$arr[$i] = $i;
return $arr;
@Kcko
Kcko / SassMeister-input-HTML.html
Last active October 12, 2015 08:10
Multi sass list
<div class="container">
<div class="a">1</div>
<div class="b">2</div>
<div class="c">
<div>3.1</div>
<div>3.1</div>
<div>3.1</div>
<div class="container">
<div class="a">1</div>
<div class="b">2</div>
<div class="c">
<div>3.1</div>
<div>3.1</div>
<div>3.1</div>

jQuery Caret

This is a very simple lightweight plugin to allow you to move the caret (or cursor) position in an <input /> or <textarea> element.

By exposing three jQuery.fn methods you can easily move a a caret to any position you like:

$.fn.caretTo( index , [ offset ] )

@Kcko
Kcko / php-sanitize-multidimensional-array.php
Last active August 29, 2015 14:26 — forked from esthezia/php-sanitize-multidimensional-array.php
PHP - Sanitize a multidimensional array
<?php
/**
* Sanitize a multidimensional array
*
* @uses htmlspecialchars
*
* @param (array)
* @return (array) the sanitized array
*/
@Kcko
Kcko / gist:bc336064e48a544f60e6
Last active August 29, 2015 14:27 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@Kcko
Kcko / jquery-selector.js
Last active June 29, 2022 21:58
jquery simple plugins
(function($) {
$.extend($.expr[':'], {
group: jQuery.expr.createPseudo(function(num) {
return function(elem) {
if (isNaN(num)) {
return false;
}
return ($(elem).index() - 1) % (num * 2) < num;
};
@Kcko
Kcko / use-events-with-data.js
Last active January 30, 2020 10:46
Use event with function and data // ukazka pouziti eventu, funkce, data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>TEST</title>
<script src="jquery.js"></script>
<style>
@Kcko
Kcko / sif.js
Created September 16, 2015 09:09
Self invoke function with public and private methods
var log = {
target: $("#message"),
pridej: function(text){
this.target.append(text + "<br />");
},
clear: function()
{