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 / index.html
Last active August 29, 2015 14:13
Single, er.. FilteredMultiSelect - http://bl.ocks.org/insin/985c434f8bf736dc45a1/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React &lt;FilteredMultiSelect/&gt;</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<script src="http://fb.me/react-0.12.2.js"></script>
<script src="http://fb.me/JSXTransformer-0.12.2.js"></script>
<Script src="react-filtered-multiselect-single.js"></script>
@insin
insin / app.jsx
Last active May 30, 2023 20:02
react-calendarbits: Simple components for rendering calendars for prototyping date-based stuff (Live version: http://bl.ocks.org/insin/raw/56a10daa808cdcdcbf83/)
void function() { 'use strict';
var cx = (staticClasses, conditionalClasses) => {
var classNames = []
if (typeof conditionalClasses == 'undefined') {
conditionalClasses = staticClasses
}
else {
classNames.push(staticClasses)
}
const path = require('path');
const watchify = require('watchify');
const browserify = require('browserify');
const gulp = require('gulp');
const changed = require('gulp-changed');
const through2 = require('through2');
const gutil = require('gulp-util');
const source = require('vinyl-source-stream');
import webidlClassGenerator from 'webidl-class-generator';
@insin
insin / GridLayout.xml
Last active August 29, 2015 14:10
Speculative JSX API for form layouts using http://kumailht.com/gridforms/
<Form form={ProductForm} ref="productForm">
<GridLayout>
<Row span="4">
<Field name="productName" span="3"/>
<Field name="tags"/>
</Row>
<Row>
<Field name="vendor"/>
<Field name="productType"/>
</Row>
@insin
insin / app.jsx
Last active August 29, 2015 14:10
Getting the route <RouteHandler/> will render - API for this?
var {Route, RouteHandler} = ReactRouter
var App = React.createClass({
contextTypes: {
getRouteAtDepth: React.PropTypes.func.isRequired,
routeHandlers: React.PropTypes.array.isRequired
},
render() {
var route = this.context.getRouteAtDepth(this.context.routeHandlers.length - 1)
@insin
insin / newforms_async_design.md
Last active August 29, 2015 14:09
What happens when you design by writing real code against a speculative API first
var SignupForm = form.Form.extend({
  username: forms.CharField(),

  /**
   * @param {function(err, field, errorMessages)} cb
   */
  cleanUsernameAsync: function(cb) {
    // Return false to indicate that no async validation is being performed -
@insin
insin / cancellable.js
Last active June 22, 2018 16:55
Cancellable callback wrapper
/**
* Returns a function with a .cancel() function which can be used to prevent the
* given function from being called.
*
* Use case: triggering an asyncronous function with new data while an existing
* function for the same task but with old data is still pending a callback, so
* the callback only gets called for the last one to run.
*/
function cancellable(func) {
var cancelled = false
var CULTURE_SHIP_NAMES = [
"5*Gelish-Oplule"
, "7*Uagren"
, "8*Churkun"
, "8401.00 Partial Photic Boundary"
, "A Fine Disregard for Awkward Facts"
, "A Momentary Lapse Of Sanity"
, "A Series Of Unlikely Explanations"
, "A Ship With A View"
, "Abalule-Sheliz"
@insin
insin / gist:9ba8d121e54329de9b73
Created November 12, 2014 15:47
In your face, firewall!
.d$b. .d$b. .d$$$$$$b. .d$$$$$$b. .d$$$$$$b. .d$b..d$$$$$$$$b.
$$$$$..$$$$$.$$$$$$$$$$$b .$$$$$$$$$$$b $$$$$$$$$$b $$$$$$$$$$$$$$$P'
$$$$$$$$$$$$d$$$$$$$$$$$$bd$$$$$$$$$$$$b$$$$$$$$$$$b$$$$$$$$$$$$$$$b.
$$$$$$$$$$$$Q$$$$$$$$$$$$PQ$$$$$$$$$$$$P$$$$$$$$$$$P$$$$$$$$$$$$$$$P'
$$$$$´`$$$$$'$$$$$$$$$$$$''$$$$$$$$$$$$'$$$$$$$$$$P $$$$$$$$$$$$$$$b.
'Q$P' 'Q$P' 'Q$$$$$$P' 'Q$$$$$$P' 'Q$$$$$$$P 'Q$P''Q$$$$$$$$P'
Version: 0.6.3 (node v0.10.31, npm 2.1.7, platform: win32)
[hoodie] The npm registry is available
@insin
insin / gulpfile.js
Created November 8, 2014 21:14
Watch and rebuild Sphinx docs with Gulp
var gulp = require('gulp')
var shell = require('gulp-shell')
gulp.task('build-docs', shell.task('make html', {cwd: './docs'}))
gulp.task('docs', ['build-docs'], function() {
gulp.watch(['./docs/*.rst', './docs/*.py'], ['build-docs'])
})