This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* parse given query string url, and return it as | |
* object literal with proper type casting for primitives | |
* | |
* @param {string} url | |
* @return {object} queryString | |
* | |
* notes: | |
* - requires jQuery for linear typecasting | |
* - parameter names are all lowercased |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* string parser with data passed as arguments | |
* | |
* @param {arguments} | |
* @return {string} | |
* | |
* example: | |
* -------- | |
* 'i used both [0] & [1], however [1] looks good so far'.parse( 'iphone', 'andoird' ); // "i used both iphone & andoird, however andoird looks good so far" | |
* 'the weather now in [0] seems to be [1]'.parse( 'Dubai', function() { return 'very hot'; }); // "the weather now in Dubai seems to be very hot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* simulating constant behaviour where | |
* given value cannot be changed | |
* | |
* @param {object} target object where the constant will be defined | |
* @param {string} key | |
* @param {object} value | |
* @return {object} constant | |
* | |
* example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Car() { | |
this.array = []; | |
this.log = function() {} | |
} | |
Car.prototype.something = function() { | |
var self = this; // <- fine | |
this.array.forEach( function(item) { | |
self.log( item ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* node js module to add `@charset "utf-8"` to all | |
* sass files in the current directory | |
* ----------------------------------- | |
* sovles this bug: | |
* https://github.com/sass/sass/issues/1037 | |
* https://github.com/Compass/compass/issues/205 | |
*/ | |
var fs = require( 'fs' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* polyfilling console.time & timeEnd | |
* on IE | |
*/ | |
(function( console ) { | |
// cache to hold running timers | |
console._timers = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
// rtl variables | |
$bi-app-left : right; | |
$bi-app-right : left; | |
$bi-app-direction : rtl; | |
$bi-app-invert-direction: ltr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* polyfill `getComputedStyle` in IE | |
*/ | |
window.getComputedStyle = window.getComputedStyle || function( element ) { | |
return element.currentStyle; | |
} | |
/** | |
* detect RTL layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* knockout observable subscriber that will get triggered only once at most | |
* | |
* @param {fn} handler | |
* @param {object} [optional] context | |
*/ | |
ko.observable.fn.subscribeOnce = function( handler, context ) { | |
var subscribtion = this.subscribe(function() { | |
handler.apply( this, arguments ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.some-selector { | |
background: white #{inline_image("image.png")} | |
} |
OlderNewer