Skip to content

Instantly share code, notes, and snippets.

@gggritso
gggritso / meatronome.js
Created January 5, 2015 02:41
Meatronome
( function() {
function appendStyleSheet() {
var style = document.createElement( 'style' );
style.appendChild( document.createTextNode( '' ) ); // for WebKit
document.head.appendChild( style );
style.sheet.insertRule( '#meatronome { height: 10px; position: absolute; top: 0; width: 100%;}', 0 );
@gggritso
gggritso / nginx_spa.conf
Created December 19, 2014 21:58
Nginx configuration for SPA
root /var/www/your_site;
location / {
try_files $uri /index.html;
}
@gggritso
gggritso / gulp-superstatic.js
Created November 5, 2014 16:14
Gulp + Superstatic
var
gulp = require( 'gulp' ),
superstatic = require( 'superstatic' );
gulp.task( 'server', function() {
var server = superstatic({
clean_urls: true,
routes: {
'/**': 'index.html',
@gggritso
gggritso / albums.md
Created October 26, 2014 20:02
Favourite Albums

Favourite Albums

I very rarely listen to albums in their entirety. These are the exceptions, my favourite records:

  • "A Different Kind of Fix" by Bombay Bicycle Club (light, summery, pop)
  • "Voices" by Phantogram (dark, heavy, moody, vocals)
  • "Elephant Shell" by Tokyo Police Club (alt-rock, energetic)
  • "Chunk of Change" by Passion Pit (EP, electronic, distorted, heavier)
  • "In Rainbows" by Radiohead (radiohead)
  • "Reise Reise" by Rammstein (industrial, German, metal, weird)
@gggritso
gggritso / console.lol.js
Created October 10, 2014 03:33
console.lol
console.lol = function() {
var harray = [], harrumpf = Math.floor( Math.random() * 10 + 2 );
while ( harrumpf-- ) harray.push( 'ha' );
console.log( harray.join( '' ) + '!' );
}
@gggritso
gggritso / meatpause.js
Last active August 29, 2015 14:06
MeatPause
( function() {
document.addEventListener( 'click', function( event ) {
var target = event.target;
if ( !target || target.nodeName !== 'VIDEO' ) { return; }
if ( target.paused ) {
target.play();
} else {
@gggritso
gggritso / install_ipython.sh
Created April 4, 2014 20:18
Install IPython 2.0.0 on OS X
brew rm python
brew rm gdbm
brew rm --force sqlite3
brew install gdbm --universal
brew install python --universal --framework
brew install zmq sqlite3
virtualenv venv
. venv/bin/activate
@gggritso
gggritso / snapclass.js
Created March 28, 2014 20:50
Snap.svg addClass and removeClass
Snap.plugin( function( Snap, Element, Paper, global ) {
Element.prototype.addClass = function( klasses ) {
if ( !( klasses instanceof Array ) ) { klasses = [ klasses ]; }
var currentKlasses = ( this.attr( 'class' ) || '' ).split( ' ' );
if ( currentKlasses === [ '' ] ) {
this.attr({ 'class': klasses.join( ' ' ) });
return this;
@gggritso
gggritso / Instructions.md
Last active December 27, 2015 05:29
A KeyRemap4Macbook file to enable fn+F1 keys on OS X with a WASD Keyboard.

Instructions

  • set key repeat delay to 200ms, and repeat to 20ms
  • enable all Fn+FX to FX remappings
  • don't remap internal keyboard, Apple keyboards or Apple's pointing devices
  • "Change F1..F19 Key & Functional Key (Brightness Control) > MacBook Series > F1, F2 to Brightness Adjust, and so on
  • Application Key to Fn
@gggritso
gggritso / Crank-Nicolson.m
Created December 4, 2011 18:15
Crank-Nicolson method for solving a simple diffusion/heat problem with time-dependence.
%% Startup
clc
clear all
close all
%% Definitions
% Axis
dx = 0.1;