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 / app.jsx
Last active September 15, 2016 09:03
ObjectEditor with React.js (Live version: http://bl.ocks.org/insin/raw/8936b2390c8e06892998/)
/** @jsx React.DOM */
'use strict';
// Utils
var cx = React.addons.classSet
function noop() {}
@insin
insin / favouritethings.html
Created July 16, 2014 19:26
My daughter's first web page
<!DOCTYPE html>
<html>
<body style="color: purple">
<h1>favourite things</h1>
Loombands<br>
Basil and cedric<br>
Mario<br>
sweets<br>
creatures<br>
@insin
insin / app.jsx
Last active July 13, 2021 07:39
React Form Handling - handleFormInputChange (Live version: http://bl.ocks.org/insin/raw/082c0d88f6290a0ea4c7/)
var INPUT_TYPES = 'color|date|datetime|datetime-local|file|month|number|password|range|search|tel|text|time|url|week'.split('|')
var App = React.createClass({
getInitialState: function() {
return {}
},
onChange: handleFormInputChange,
render: function() {
@insin
insin / index.html
Last active August 29, 2015 14:03
React Questions - dumb-as-rocks, JSON-driven question sets / http://bl.ocks.org/insin/raw/a32a5f086d0028239044/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Questions</title>
<script src="http://fb.me/react-0.10.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.10.0.js"></script>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css">
@insin
insin / app.jsx
Last active August 29, 2015 14:02
React version of http://n12v.com/2-way-data-binding/ without double conversion issue. Live version: http://bl.ocks.org/insin/raw/3f4c479fc55eb2d0d4f1/
/** @jsx React.DOM */
function c2f(c) {
return 9/5 * c + 32
}
function f2c(f) {
return 5/9 * (f - 32)
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url(https://github.com/django/django/pull/2692) {
html:before { position: absolute; top: 40%; left: 0; right: 0; text-align: center; border-top: 2px solid #000; border-bottom: 2px solid #000; padding: 1em 0; content: "Clementine will remember this..."; font-size: 46px;}
body { display: none !important; }
}
@insin
insin / locale.js
Last active August 29, 2015 14:01
Newforms locale API (speculative)
forms.addLocale('fr', {
b: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_')
, B: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_')
, DATE_INPUT_FORMATS: [
'%d/%m/%Y', '%d/%m/%y'
, '%d %b %Y', '%d %b %y'
, '%d %B %Y', '%d %B %y'
]
, DATETIME_INPUT_FORMATS: [
'%d/%m/%Y %H:%M:%S'
@insin
insin / 1.js
Created May 7, 2014 05:29
This is the sort of stuff JSX saves you from having to manage
this.$el.append(domBuilder([
['div.arrow']
, ['div.popup-header'
, ['button.close', {type: 'button'}, '\u00D7']
, ['h3', 'Add menu item']
]
, ['div.popup-body'
, ['form.form-horizontal'
, ['div.control-group'
, ['label.control-label', {'for': 'menuItemType'}, 'Type']
@insin
insin / srsly.js
Last active August 29, 2015 14:01
function new_(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) {
switch (arguments.length) {
case 0: return new this
case 1: return new this(a)
case 2: return new this(a, b)
case 3: return new this(a, b, c)
case 4: return new this(a, b, c, d)
case 5: return new this(a, b, c, d, e)
case 6: return new this(a, b, c, d, e, f)
case 7: return new this(a, b, c, d, e, f, g)
@insin
insin / dombuilder.js
Created May 6, 2014 15:18
dombuilder-2006-09-19
/*
Copyright (c) 2006 Dan Webb
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.