Skip to content

Instantly share code, notes, and snippets.

@rohn
rohn / .block
Last active March 7, 2016 18:34 — forked from mbostock/.block
Area with Missing Data
license: gpl-3.0
@rohn
rohn / .block
Last active February 19, 2016 22:25 — forked from mbostock/.block
Stacked Bar Chart
license: gpl-3.0
@rohn
rohn / extendedModule.js
Last active December 17, 2015 08:59
an example of a module pattern, extending another object
var _ = require('underscore');
// an object that we will extend later
var foo = {
baz: function() {
// some interesting behaviour
}
};
foo.baz.prototype.fubar = function() {
@rohn
rohn / _.md
Created May 1, 2013 20:42
Tributary inlet
@rohn
rohn / gist:4320987
Created December 17, 2012 19:08
Backbone: model
define(function(require) {
"use strict";
var Backbone = require("backbone");
var model = Backbone.Model.extend({
initialize: {
// initialization
},
@rohn
rohn / gist:4321027
Created December 17, 2012 19:12
Backbone: collection
define(function (require) {
"use strict";
var Backbone = require('backbone');
var model = require("model.js");
var collection = Backbone.Collection.extend({
model: model,
url: "/models.json"
@rohn
rohn / destructuring.js
Last active November 25, 2015 21:57
destructuring nested objects with value changes
const state = {a:1, b:2, c:3, d:{aa:11, bb:22}}
console.log(state) // { a: 1, b: 2, c: 3, d: { aa: 11, bb: 22 } }
const b = 55
const aa = 444
const total = {...state, b, d: {...state.d, aa}}
console.log(total) // { a: 1, b: 55, c: 3, d: { aa: 444, bb: 22 } }
@rohn
rohn / gulpfile.js
Last active August 29, 2015 14:16
my current fast create gulpfile.js & package.json for quick web page making
var gulp = require('gulp');
var gutil = require('gulp-util');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var connect = require('gulp-connect');
var header = require('gulp-header');
var jpegoptim = require('imagemin-jpegoptim');
var jshint = require('gulp-jshint');
var livereload = require('gulp-livereload');
var optipng = require('imagemin-optipng');
module.exports = function (grunt) {
"use strict";
// Config...
grunt.initConfig({
watch: {
options: {
livereload: true
},
html: {
@rohn
rohn / Gruntfile.js
Created November 10, 2014 16:13
more extensive Gruntfile
'use strict';
module.exports = function(grunt) {
//
// Load Tasks
//
require('load-grunt-tasks')(grunt, [
'grunt-*',