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
/*
* 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'),
@chrisbuttery
chrisbuttery / README
Last active August 29, 2015 14:02
Gulp + Browserify
This example uses Browserify and expects a stucture like
|- gulpfile.js
|
|- package.json
|
|- [javascript]
| |
| | - app.js
| |
var promise = getPromise('http://api.icndb.com/jokes/random')
promise.then(function(data) {
console.log('Got data! Promise fulfilled.'); // 1st request finished
// 2nd request
return getPromise('http://api.icndb.com/jokes/random');
}).then(function(result) {
console.log('the final result');
});
{
// --------------------------------------------------------------------
// 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
@chrisbuttery
chrisbuttery / tweet1.json
Last active August 29, 2015 14:05
Example tweets
{
"user": {
"name": "Lonely Bob",
"handle": "lonelyBob"
},
"message": "Oh man, did you just hear that? What was that?!!!",
"favourited": true
}
@chrisbuttery
chrisbuttery / promises.html
Created August 15, 2014 10:45
Synchronous asynchronous JavaScript - Promises
<html>
<head>
<style>
body {
background: #f5f8fa;
font: 16px/22px Arial, sans-serif;
margin: 0;
}
.statList {
background: #fff;
@chrisbuttery
chrisbuttery / callback-hell.html
Created August 15, 2014 10:46
Synchronous asynchronous JavaScript - Callback hell
<html>
<head>
<style>
body {
background: #f5f8fa;
font: 16px/22px Arial, sans-serif;
margin: 0;
}
.statList {
background: #fff;
@chrisbuttery
chrisbuttery / slightly-nicer-callbacks.html
Created August 15, 2014 10:47
Synchronous asynchronous JavaScript - Slightly nicer callbacks
<html>
<head>
<style>
body {
background: #f5f8fa;
font: 16px/22px Arial, sans-serif;
margin: 0;
}
.statList {
background: #fff;
@chrisbuttery
chrisbuttery / nicer-callbacks.html
Created August 15, 2014 10:47
Synchronous asynchronous JavaScript - Nicer callbacks
<html>
<head>
<style>
body {
background: #f5f8fa;
font: 16px/22px Arial, sans-serif;
margin: 0;
}
.statList {
background: #fff;
{
"users": [
{
"firstName": "Max",
"lastName": "Wheeler",
"username": "maxwheeler",
"checkedIn": true
},
{
"firstName": "Tim",