Skip to content

Instantly share code, notes, and snippets.

View donovanh's full-sized avatar

Donovan Hutchinson donovanh

View GitHub Profile
@donovanh
donovanh / database.js
Created July 6, 2021 05:42
Example Movies and Actors Database
'use strict';
const actors = {
a01: {
id: 'a01',
name: 'Harvey Keitel'
},
a02: {
id: 'a02',
name: 'Tim Roth'
// 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');
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));
});
@donovanh
donovanh / test.js
Last active November 6, 2018 16:35
console.warn('Sending an error to browser')
BOOM
@donovanh
donovanh / gulpfile.js
Created July 28, 2014 21:01
Gulp file for Jekyll, with Sass, Autoprefixer, and browsersync
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'),
/*
* 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
@donovanh
donovanh / app.js
Last active January 18, 2016 17:11
Cat -> Dog (Node.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 October 3, 2013 15:56
Here are some things you can do with Gists in GistBox.
// 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 December 18, 2015 16:58 — 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.
# 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 April 20, 2013 16:56
Mixins for SASS including: - Animation - Keyframes - Text fill/stroke
/* Mixins to extend what Compass provides */
=animation($values...)
-webkit-animation: $values
-moz-animation: $values
-o-animation: $values
-ms-animation: $values
animation: $values
=keyframes($name)