Skip to content

Instantly share code, notes, and snippets.

View chrisbuttery's full-sized avatar
🏠
Working from home

Chris Buttery chrisbuttery

🏠
Working from home
View GitHub Profile
@chrisbuttery
chrisbuttery / test.js
Last active August 29, 2015 14:17 — forked from miguelmota/test.js
var test = require('tape');
var request = require('supertest');
var server = require('../../server');
test('barcode route', function(t) {
request(server)
.get('/api/1/code')
.expect(200)
.expect('Content-Type', /json/)
.expect({"code":{"code":"1M4A67AE3H94RS6GG74M"}})
import {component,dom} from 'deku'
// Define a component with a name for debugging
const Button = component('My Button')
// Define properties
Button
.prop('foo', { type: 'string', optional: true, expects: ['hello', 'goodbye'] })
.prop('bar', { type: 'boolean', default: false })
// ES6 for loops
// =============
// Things in ES6 can be "iterable". Arrays are iterable by default.
var fruits = ['Apple', 'Banana', 'Grape'];
for (var fruit of fruits)
console.log('Fruit: ' + fruit);
function hostReachable() {
// Handle IE and more capable browsers
var xhr = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" );
var status;
// Open new request as a HEAD to the root hostname with a random param to bust the cache
xhr.open( "HEAD", "//" + window.location.hostname + "/?rand=" + Math.floor((1 + Math.random()) * 0x10000), false );
// Issue request and handle response
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
/*
* Require our plugins.
*/
var gulp = require('gulp'),
debug = require('gulp-debug'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
/*
* Require our plugins.
*/
var gulp = require('gulp'),
debug = require('gulp-debug'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
var Form = require('form');
function PersonalDetails(el, model) {
this.el = el;
this.model = model;
this.form = new Form(el);
}
@chrisbuttery
chrisbuttery / svg-logo.scss
Created November 19, 2012 10:28 — forked from jnowland/svg-logo.scss
Logo mixin to include fallback SVG
// Im not really sure what your intention is for this mixin.
// Originally it looked like you were including this mixin to a parent class,
// that would then create the .logo styles along with .svg & .no-svg fallback classes.
// This example includes the mixin to .logo since we know its going to exist anyhow.
// Dont know if it actuualy helps you, I'd need more info.
@mixin svg-logo($img-name) {
// Compass cant get an image width/height from just a name, its needs an actual image,
// which wouldnt work in this case.
@chrisbuttery
chrisbuttery / gist:2250357
Created March 30, 2012 09:37 — forked from atg/gist:2153106
These are the things that would keep me in Chocolat and keep me from reverting back to textmate
Drag a file/folder into terminal:
http://cl.ly/1Y0x0J0p0C0q303R1f1W (man, i need this!)
Nice to haves:
* Close Multiple open files: http://cl.ly/2q2u3k1E3C2O3d3v2g07
* "Save All" option under 'File' to save all unsaved files.
Would be nice if an unsaved file was more defined: http://cl.ly/2n420x1432441W2w2r0p