Skip to content

Instantly share code, notes, and snippets.

View raiden-dev's full-sized avatar
👨‍🚀

Andrey Kravtsov raiden-dev

👨‍🚀
View GitHub Profile
@raiden-dev
raiden-dev / filename.jquery.html
Created December 27, 2013 06:28
Cut the filenames pretty way
<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
.filename { width: 150px; margin: 5px 10px; padding: 5px 10px; border:1px solid #000; overflow: hidden; }
</style>
</head>
<body>
@raiden-dev
raiden-dev / prime.js
Created February 11, 2013 20:49
Prime numbers generator with simple caching
/**
* Prime numbers generator
* @constructor
*/
function Prime() {
this.primes = [1];
}
/**
* Test for primality
@raiden-dev
raiden-dev / condevents.jquery.js
Created October 17, 2012 16:23
jQuery Plugin: Conditional Custom Events
/**
* Conditional Custom Events
* jQuery Plugin
* based on setInterval()
*/
;(function ($, window, undefined) {
// Define conditional events
function defineCondEvents(element, events) {
var intervals = [];
var delay = 10;
@raiden-dev
raiden-dev / ko-transitions.html
Created September 18, 2012 14:34
KnockoutJS Custom Binding: transitions
<!doctype html>
<html>
<head>
<title>KnockoutJS Custom Binding: transitions</title>
<style>
/* WARNING: Only webkit transition defined */
.transitions {
position: absolute;
width: 200px;
height: 200px;
@raiden-dev
raiden-dev / ko-animation.html
Created September 18, 2012 11:25
KnockoutJS Custom Binding: animation
<!doctype html>
<html>
<head>
<title>KnockoutJS Custom Binding: animation</title>
<style>
/* WARNING: Only webkit animation defined */
@-webkit-keyframes zigzag {
0% { top: 0px; left: 0px; }
25% { top: 200px; left: 200px; }
50% { top: 0px; left: 400px; }
@raiden-dev
raiden-dev / ko-gaqpush.js
Created September 17, 2012 16:33
KnockoutJS Custom Binding: gaqPush
/**
* KO: Google Analytics data pusher.
* @param {array|object} Binding value.
* @config {array} GA track data.
* @config {object}
* {array} [track] GA track data.
* {string} [eventName='click'] Event name.
* @requires GA Tracker <ga.js>
* @example
* // View
@raiden-dev
raiden-dev / ko-pointer.js
Created September 17, 2012 14:26
KnockoutJS Custom Binding: pointer
/**
* KO: Collects and cache pointers to elements.
* @param {string|object} Binding value.
* @config {string} The pointer's id.
* @config {object}
* {obArray} [ob=pointers]
* Observable Array to store cache.
* {string} [id] The pointer's id.
* @example
* // View