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
// The quick brown fox jumps over the lazy dog | |
var hasAttributes = function (animal, attributes) { | |
var matches = 0; | |
for (var i = 0; i < attributes.length; i += 1) { | |
if (animal.attributes.indexOf(attributes[i]) >= 0) { | |
matches += 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
/* HTML | |
<div class="file"> | |
<div class="icon"></div> | |
<span class="filename"> | |
<span class="name"> | |
Filename<span class="extension">.ext</span> | |
</span> | |
</span> |
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
import urllib2, time, socket | |
from datetime import datetime | |
previous_state = 'Monitoring started' | |
current_state = 'Monitoring started' | |
readable_time = None | |
time_now = None | |
disconnected_time = None | |
def start_monitoring(): |
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" |
OlderNewer