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
$(document).ready(function () { | |
// Find thumbnail containers | |
$('.thumbContainer').each(function () { | |
// Get current thumbnail container | |
var thumb = $(this); | |
// Get current thumbnail image | |
var img = thumb.children('img'); | |
// Calculate image ratio | |
var ratio = img.innerWidth() / img.innerHeight(); | |
var newW, newH; |
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
var o_0 = {}; | |
o_0.isOdd = function(thing, normal) { | |
return thing !== normal; | |
}; | |
o_0.isANinja = function (element) { | |
return element.style.visibility === 'hidden'; | |
}; |
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
var ifTrue = function (value) { | |
var resolved, stored; | |
var result = value; | |
return { | |
then: function (fn) { | |
if (value) { | |
if (typeof fn === 'function') { | |
fn(); | |
} else { |
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
var ternary = function (bool, success, fail) { | |
return bool ? success : fail; | |
}; | |
var message = ternary(true, 'Hello', ternary(true, 'Werld', 'World')); | |
console.log(message); |
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
/* | |
# Flip a table from columns to rows & vice versa e.g. | |
var table = [ | |
['Date', 'Jan', 'Feb', 'Mar', 'Apr', 'May'], | |
['Data 1', 45, 63, 68, 44, 86], | |
['Data 2', 57, 74, 15, 44, 53], | |
['Data 3', 47, 37, 76, 64, 62] | |
]; |
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
var isJavascriptInsane = function () { | |
return typeof ({} + []) === 'string'; | |
}; |
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
/* | |
* Also consider rules from this | |
* https://github.com/yannickcr/eslint-plugin-react | |
*/ | |
{ | |
"rules": { | |
"strict": [ | |
2, | |
"function" |
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
/* global $ */ | |
/* | |
* JSFiddle: http://jsfiddle.net/dswf3mh6/ | |
*/ | |
(function () { | |
'use strict'; | |
$.get('https://www.hipchat.com/emoticons', function (response) { |
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
var Ternary = function (condition, result) { | |
var resolved; | |
if (condition) { | |
resolved = result; | |
} | |
var ifFn = function (condition, result) { | |
if (resolved) { | |
return new Ternary(true, resolved); |
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
let preprops = { | |
foo: 'bar' | |
}; | |
spyOn(Redux, 'connect').andReturn(function (UnconnectedComponent) { | |
return class Prepropulator extends React.Component { | |
render() { | |
let props = Object.assign({}, this.props, preprops); | |
return ( |
OlderNewer