This file contains hidden or 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
| /** | |
| * Fisher–Yates Shuffle - https://bost.ocks.org/mike/shuffle/ | |
| * @param array - {array} - The array to shuffle | |
| * @returns {array} - The shuffled array | |
| */ | |
| function shuffleItems(array) { | |
| var m = array.length, t, i; | |
| // While there remain elements to shuffle… | |
| while (m) { | |
| // Pick a remaining element… |
This file contains hidden or 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
| /*jslint bitwise: true, indent: 2, nomen: true, regexp: true, stupid: true*/ | |
| (function () { | |
| 'use strict'; | |
| var exports = {}; | |
| exports.uuid4 = function () { | |
| //// return uuid of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx | |
| var uuid = '', ii; | |
| for (ii = 0; ii < 32; ii += 1) { | |
| switch (ii) { | |
| case 8: |
This file contains hidden or 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
| { | |
| "name": "my-app", | |
| "version": "1.0.0", | |
| "description": "My test app", | |
| "main": "src/js/index.js", | |
| "scripts": { | |
| "jshint:dist": "jshint src/js/*.js", | |
| "jshint": "npm run jshint:dist", | |
| "jscs": "jscs src/*.js", | |
| "browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js", |
This file contains hidden or 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
| /** | |
| * Get all siblings of an element | |
| * @param {Node} elem The element | |
| * @return {Array} The siblings | |
| */ | |
| var getSiblings = function (elem) { | |
| var siblings = []; | |
| var sibling = elem.parentNode.firstChild; | |
| for (; sibling; sibling = sibling.nextSibling) { | |
| if ( |
This file contains hidden or 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
| /* euclidean GCD (feel free to use any other) */ | |
| function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;} | |
| /* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */ | |
| function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)} | |
| /* eg: | |
| > ratio(320,240) | |
| "4:3" | |
| > ratio(360,240) |
This file contains hidden or 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 React, {PropTypes} from 'react'; | |
| import classNames from 'classnames'; | |
| class BatchDropZone extends React.Component { | |
| static propTypes = { | |
| // function that recieves an array of files | |
| receiveFiles: PropTypes.func.isRequired, |
This file contains hidden or 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
| /** | |
| * A function to determine if an array contains an item | |
| * @param needle - [Number||String] - The array to search through | |
| * @returns [boolean] - Returns true or false | |
| */ | |
| function arrContainsItem(needle) { | |
| var findNaN = needle !== needle; // Per spec, the way to identify NaN is that it is not equal to itself | |
| var indexOf; | |
| if(!findNaN && typeof Array.prototype.indexOf === 'function') { |
This file contains hidden or 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
| // TODO - Only operates on a single object at the moment. | |
| // TODO - would be nice to be able to operate on more than one key at a time | |
| function changeKey(oldKey, newKey, arr) { | |
| // Create a temporary array | |
| var newArr = []; | |
| // Loop through everything in the original array | |
| for (var i = 0; i < arr.length; i++) { | |
| // Create a reference to the current object that you're operating on within the array | |
| var obj = arr[i]; |
This file contains hidden or 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
| #bermuda-triangle { | |
| display: none; | |
| } | |
| #chuck-norris { | |
| color: #BADA55; | |
| } | |
| .push-up-bra { | |
| margin-top: -25%; overflow: visible; | |
| } | |
| #wife { |