Skip to content

Instantly share code, notes, and snippets.

Avatar

Donovan Hutchinson donovanh

View GitHub Profile
View list-items.js
var randomColours = ['3c6dd1', 'd13c9e', '3cd19e'];
var currentColour = 0;
var currentDemoColour = 0;
$(function() {
$('.add-to-list button').click(function(e) {
addLI($(e.target).parent(), false);
});
$('.add-to-list li').each(function(index, item) {
bindNewLI($(item));
});
View test.js
console.warn('Sending an error to browser')
BOOM
@donovanh
donovanh / gulpfile.js
Created Jul 28, 2014
Gulp file for Jekyll, with Sass, Autoprefixer, and browsersync
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
View twitter-entities.js
/*
* twitter-entities.js
* This function converts a tweet with "entity" metadata
* from plain text to linkified HTML.
*
* See the documentation here: http://dev.twitter.com/pages/tweet_entities
* Basically, add ?include_entities=true to your timeline call
*
* Copyright 2010, Wade Simmons
* Licensed under the MIT license
View Gulpfile for Mocha & Node.js
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var mocha = require('gulp-mocha');
@donovanh
donovanh / app.js
Last active Jan 18, 2016
Cat -> Dog (Node.js)
View app.js
/*
This is a Node application that generates paths between two words. Spec:
Write some code that will, given a word, e.g. dog, and another word, e.g. cat, will output a sequence of valid words (in a dictionary), where each pair of adjacent words are only different by 1 character. e.g. dog -> dot -> cot -> cat. If you can, also output the entire list of all such paths between two words.
Usage:
* Install Node
* Place "app.js" and "dictionary.js" files in a directory
* In terminal, navigate to the directory and run "node app"
The method (cat2DogAllPaths) accepts 3 arguments:
@donovanh
donovanh / 0_reuse_code.js
Created Oct 3, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@donovanh
donovanh / gist:5814722
Last active Dec 18, 2015 — forked from oisin/gist:4444722
A handy bash prompt customization that shows the working directory followed by the current branch, and an asterisk if the branch is dirrrrty.
View gist:5814722
# Highlighting on prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
COLOR_NONE="\[\e[0m\]"
parse_git_branch() {
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
@donovanh
donovanh / Animation & text mixins
Created Apr 20, 2013
Mixins for SASS including: - Animation - Keyframes - Text fill/stroke
View Animation & text mixins
/* Mixins to extend what Compass provides */
=animation($values...)
-webkit-animation: $values
-moz-animation: $values
-o-animation: $values
-ms-animation: $values
animation: $values
=keyframes($name)
@donovanh
donovanh / vacuumtrace.txt
Created Apr 28, 2012
Full trace - Vacuum setup issue
View vacuumtrace.txt
vacuum (0.2.2) lib/vacuum/endpoint/base.rb:17:in `key'
app/controllers/home_controller.rb:7:in `block in index'
vacuum (0.2.2) lib/vacuum/request/base.rb:46:in `configure'
app/controllers/home_controller.rb:6:in `index'
actionpack (3.2.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.2) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.2) lib/active_support/callbacks.rb:414:in `_run__848510956938163028__process_action__2492995424481165270__callbacks'
activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `__run_callback'
You can’t perform that action at this time.