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
| /* 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
| Perl and PHP Regular Expressions | |
| PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters. | |
| All Major Credit Cards | |
| This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa. | |
| //All major credit cards regex | |
| '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/' |
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
| (function($, window, undefined) { | |
| var InfiniteScroll = function() { | |
| this.initialize = function() { | |
| this.setupEvents(); | |
| }; | |
| this.setupEvents = function() { | |
| $(window).on( | |
| 'scroll', | |
| this.handleScroll.bind(this) |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <link rel="stylesheet" href="style.css"> | |
| <title>Draggable</title> | |
| </head> |