Skip to content

Instantly share code, notes, and snippets.

View hunterc's full-sized avatar

Hunter Cassidy hunterc

View GitHub Profile
@hunterc
hunterc / filterlist.js
Created December 5, 2014 15:05
react component to create filter list
/** @jsx React.DOM */
var itemList = [
'Apples',
'Pie',
'Brocooli',
'Chicken',
'Duck',
'Eggs',
'Fish',
@hunterc
hunterc / gist:c2e12c4a99f43682fd7c
Created November 18, 2014 16:55
npm tarball url bug dump
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'https://api.github.com/repos/kiplic/tardis/tarball/master' ]
2 info using npm@2.1.8
3 info using node@v0.10.33
4 verbose node symlink /usr/local/bin/node
5 silly cache add args [ 'https://api.github.com/repos/kiplic/tardis/tarball/master',
5 silly cache add null ]
@hunterc
hunterc / stringUtil.js
Last active August 29, 2015 13:56
JS String startsWith, endsWith methods
var stringUtil = (function(global)) {
// prototype modifiers
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function(str) {
return this.slice(0, str.length) === str;
};
}
if (typeof String.prototype.endsWith !== 'function') {
@hunterc
hunterc / validator.js
Created February 3, 2014 19:23
Form field validator: currently requires a fieldmap with jquery element
(function (global) {
'use strict';
var Validator = function Validator() {
this.schemas = {
text: {
maxLength: function (val, prop) {
return {
success: val.length <= prop.maxLength,
msg: 'Value exceeds maximum length: ' + prop.maxLength + '.'