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 posit( x, positivity ){ | |
return x * ( positivity * 2 - 1 ); | |
} |
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
// Selects the text of the scoped element. | |
// Courtesy of @jcubic: http://stackoverflow.com/a/21829549/356541 | |
$.fn.sel = function selectText() { | |
var node = this[0]; | |
if ( document.body.createTextRange ) { | |
var range = document.body.createTextRange(); | |
range.moveToElementText( node); | |
range.select(); | |
} else if ( window.getSelection ) { |
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
{ | |
"foo" : "bar" | |
} |
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
{ | |
"" : "// Start Zepto ", | |
"zepto" : "../../lib/zepto/zepto", | |
"zepto-extras" : "../../lib/zepto/zepto-extras", | |
"zepto-slide-transition" : "../../lib/zepto/zepto-slide-transition", | |
"zepto-fx-methods" : "../../lib/zepto/zepto-fx-methods", | |
"" : "// End Zepto ", | |
"" : "// Start jQuery ", | |
"jquery" : "../../lib/jquery/jquery-1.10.2", |
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
jQuery.csi = function csi( context ){ | |
$( '[data-include]', context || document ).each( function fetchPartial(){ | |
var $placeholder = $( this ); | |
var location = $placeholder.attr( 'data-include' ); | |
$.ajax( { url : location, async : false } ).done( function injectPartial( response ){ | |
var $partial = $( response ); | |
csi( $partial ); |
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
// Increase class-level specificity of a rule without functionaly modifying the selector | |
@mixin increase-specificity( $depth: 1 ) { | |
$sel : ''; | |
@while($depth > 0) { | |
$sel : $sel + ':nth-child(n)'; | |
$depth : $depth - 1; | |
} | |
&#{$sel} { |
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 getParentStructure( el ){ | |
var $el = $( el ); | |
var indent = ''; | |
var output = ''; | |
_.chain( $el.parents() ).reverse().map( function convertToString( parent ){ | |
var attributes = parent.attributes; | |
output += indent + '<' + parent.tagName.toLowerCase(); |
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
// returner is a convenience function that allows you to invoke mutator methods on arrays (or anything else) | |
// and return the mutated array itself rather than some arbitrary property of that array. | |
// | |
// Why? | |
// I have never been convenienced by the returned length of an array after pushing to it. | |
// I have often wanted to push to an array and return it with the same statement. | |
// | |
// Seriously? Like, when? | |
// Can I use a word in its own definition? At line 27, I want to modify an array and return it. | |
// Thanks to returner, I'm evaluating that as a function argument expression. |
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
_.mixin( { | |
// Like uniq, but tests for equivalence rather than identity. | |
// Does this by running comparison on stringified representations. | |
// DOM nodes and other objects with circular references can't be stringified and will break. | |
looseUniq : function uniqBasedOnStringify( source ){ | |
var output = _( source ) | |
.map( function stringify( x ){ return JSON.stringify( x ); } ) | |
.uniq() | |
.map( function parse( x ){ return JSON.parse( x ); } ) | |
.valueOf(); |
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.3.8) | |
// Compass (v1.0.0.alpha.19) | |
// ---- | |
// Placeholder using & | |
// --- | |
%C { | |
Z & { | |
property: value; |
OlderNewer