Skip to content

Instantly share code, notes, and snippets.

View insin's full-sized avatar
⚠️
Cannot read property 'status' of undefined

Jonny Buchanan insin

⚠️
Cannot read property 'status' of undefined
View GitHub Profile
@insin
insin / .jscs.json
Created February 16, 2014 01:55 — forked from anissen/.jscs.json
{
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
@insin
insin / contactform.js
Last active August 29, 2015 13:56
newforms & React Contact Form Example - http://bl.ocks.org/insin/raw/9063570/
/** @jsx React.DOM */
var STATES = [
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI',
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS',
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR',
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'
]
var BootstrapRadioInlineRenderer = forms.RadioFieldRenderer.extend({
@insin
insin / gist:9179330
Last active August 29, 2015 13:56 — forked from getify/gist:9179137
goto fail; goto fail;
// So.. this code:
if (foo) {
goto fail;
goto fail;
}
else if (bar) {
goto fail;
goto fail;
}
else if (bam) {
// Hash and OrderedObject initially based on http://dailyjs.com/2012/09/24/linkedhashmap/
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory)
}
else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
/**
* Replaces string {placeholders} with properties of a given object, but
* interpolates into and returns an array instead of a string.
* By default, any resulting empty strings are stripped out of the array. To
* disable this, pass an options object with a 'strip' property which is false.
*/
function formatToArray(str, obj, options) {
var parts = str.split(/\{(\w+)\}/g)
for (var i = 1, l = parts.length; i < l; i += 2) {
parts[i] = (object.hasOwn(obj, parts[i])
@insin
insin / allfields.js
Last active August 29, 2015 13:56
Newforms: All Default Fields - http://bl.ocks.org/insin/raw/9299833/
/**
* @jsx React.DOM
*/
var choices = [
[1, 'foo']
, [2, 'bar']
, [3, 'baz']
, [4, 'ter']
]
@insin
insin / Concur-0.2.4.min.js
Last active August 29, 2015 13:56
Newforms: Custom Form Layout - - http://bl.ocks.org/insin/raw/9335123/
/**
* Concur 0.2.4 - https://github.com/insin/concur
* MIT Licensed
*/
!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.Concur=t()}}(function(){return function t(n,r,e){function o(u,c){if(!r[u]){if(!n[u]){var f="function"==typeof require&&require;if(!c&&f)return f(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=r[u]={exports:{}};n[u][0].call(a.exports,function(t){var r=n[u][1][t];return o(r?r:t)},a,a.exports,t,n,r,e)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<e.length;u++)o(e[u]);return o}({1:[function(t,n){"use strict";function r(t,n){i.Function(n)?u.extend(t,n.prototype):u.extend(t,n)}function e(t){var n=t.__mixin__;i.Array(n)||(n=[n]);for(var e={},o=0,c=n.length;c>o;o++)r(e,n[o]);return delete t.__mixin__,u.extend(e,t)}function o(t,n,r){var e;return e=n&&u.hasOw
@insin
insin / app.jsx
Created March 9, 2014 17:41
"Template" component in React
var AddContact = React.createClass({
render: function() {
return <form ref="form">
<h2>Add {this.props.type}</h2>
{this.props.children}
<div>Phone Fields</div>
<div>Email Fields</div>
<div>Address Fields</div>
</form>
}
@insin
insin / app.js
Last active August 29, 2015 13:58
Newforms hacked for Mithril output - http://bl.ocks.org/insin/raw/9952028/
/** @jsx m */
'use strict';
var choices = [
[1, 'foo']
, [2, 'bar']
, [3, 'baz']
, [4, 'ter']
]
@insin
insin / SortableTable.js
Last active August 29, 2015 14:00
QUnit test starter example
void function () {
'use strict';
var SortableTable = {
//Initialize
init: function (element) {
this.table = element;
this.header = this.table.getElementsByTagName('thead')[0];