Skip to content

Instantly share code, notes, and snippets.

View chrisfrancis27's full-sized avatar
Verified beard

Chris Francis chrisfrancis27

Verified beard
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/konvajs/konva/1.7.4/konva.min.js"></script>
<meta charset="utf-8">
<title>Konva Clipping Function Demo</title>
<style>
body {
margin: 0;
@chrisfrancis27
chrisfrancis27 / .block
Created June 12, 2017 19:41 — forked from mbostock/.block
Force-Directed Graph
license: gpl-3.0
height: 600
@chrisfrancis27
chrisfrancis27 / .block
Last active February 21, 2017 11:48 — forked from mbostock/.block
Canvas Line
license: gpl-3.0
@chrisfrancis27
chrisfrancis27 / index.html
Created November 29, 2016 12:18
D3 transition background scheduling
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 100px;
margin: 0 auto;
<snippet>
<content><![CDATA[
/*jslint browser: true, white: true */
/*global define */
define([
'${1:dependencies}'
], function (${2:dependencyArgs}) {
'use strict';
@chrisfrancis27
chrisfrancis27 / example.js
Created January 25, 2016 11:51
Bookshelf hash IDs
'use strict';
const _ = require('lodash');
const bookshelf = require('../config/bookshelf');
const hasher = require('../utils/hasher');
require('./thing');
let Example = Bookshelf.model.extend({
tableName: 'examples',
@chrisfrancis27
chrisfrancis27 / migration.js
Created March 11, 2016 14:35
Knex 0.10.0 `undefined -> DEFAULT` test
'use strict';
exports.up = function(knex) {
return knex.schema
.createTable('things', t => {
t.increments('id').primary().unsigned();
t.text('a').notNullable().defaultTo('');
t.integer('b').notNullable().defaultTo(0);
t.boolean('c').notNullable().defaultTo(false);
})
@chrisfrancis27
chrisfrancis27 / pre-commit
Created February 17, 2016 20:47
Git pre-commit hook for warning about new occurrences of a string, e.g. "// TODO"
#!/bin/bash
# Change $stopword to whatever string you want to disallow
# N.B. It's going into a regex, so don't be ridiculous.
stopword="TODO"
########################################
# You shouldn't need to touch anything #
@chrisfrancis27
chrisfrancis27 / gist:35c6e557b46b5a5d5369
Created February 17, 2016 16:14 — forked from guilherme/gist:9604324
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@chrisfrancis27
chrisfrancis27 / Gruntfile.js
Created November 9, 2013 17:10
A pretty decent little grunt file with production and dev configurations. Useful for pre-compiling Jade and Stylus, minifying / combining CSS and JS.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Clean the build output directory before we begin
clean : {
options: {
force : true
},