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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
// Return a color object | |
function color(r, g, b) { | |
return { | |
r: r, | |
g: g, | |
b: b | |
}; | |
} | |
// Return a random number between a and b inclusive |
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 replace(phrase, query) { | |
return phrase.replace( // SEARCH the phrase... | |
RegExp('(' + // using a REGULAR EXPRESSION to capture... | |
query // all matches in the QUERY. | |
.trim() // Trim whitespace to PREVENT "EMPTY" WORDS when the query is... | |
.split(/\s+/) // split into DISCREET SEARCHABLE "WORDS" (non-whitespace terms),... | |
.sort(function(a,b) { // SORTED by... | |
return b.length - a.length; // descending length to PREVENT LOSS OF MATCHES previously replaced by shorter matches. | |
}).map(function(word) { // To capture non-word characters like PERIODS, HYPHENS, and APOSTROPHES, | |
return word.split('') // BETWEEN EACH CHARACTER of the word |
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
// https://twitter.com/angustweets/status/467117418511212544 | |
var a = [1,2,3,4,5]; | |
a.map(Date.call, Number); // [0, 1, 2, 3, 4] | |
var b = []; b.length = 5; | |
b.map(Date.call, Number); // [undefined × 5] | |
var c = [,,,,,] | |
c.map(Date.call, Number); // [undefined × 5] |
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 findLongSelectors(n) { | |
var sheets = document.styleSheets; | |
var splitRule = /\s*,\s*/; | |
var splitWhitespace = /\s+/; | |
var longRules = []; | |
[].forEach.call(document.styleSheets, function(styleSheet) { | |
if (!styleSheet.cssRules) return; | |
[].forEach.call(styleSheet.cssRules, function(cssRule) { |
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
/** | |
* Adds two numbers. | |
* @param {Number} a First addend. | |
* @param {Number} b Second addend. | |
* @return {Number} The sum of the addends. | |
* @when a is 1 and b is 2 | |
* @expect 3 | |
*/ | |
function addition(a, b) { | |
return a + b; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CardFactory</title> | |
</head> | |
<body> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script> | |
;(function(window, document, $) { |
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 fizzbuzz(n, s, i) { | |
s = { | |
0: 'FizzBuzz', | |
3: 'Fizz', | |
5: 'Buzz', | |
6: 'Fizz', | |
9: 'Fizz', | |
10: 'Buzz', | |
12: 'Fizz' | |
}; |
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
/** | |
* Base inheritable/mixable object with `create` and `mixin` functionality. | |
* @type {Object} | |
*/ | |
var Base = { | |
/** | |
* Create a new instance of the object and mixin additional behaviors. |
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 '_common' | |
/** | |
* Clock animation | |
*/ | |
@keyframes alarm | |
from | |
transform rotate(-10deg) | |
to |
OlderNewer