Skip to content

Instantly share code, notes, and snippets.

javascript: (function(){window.docCookies={getItem:function(a){return decodeURIComponent(document.cookie.replace(RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},setItem:function(a,b,c,e,f,g){if(!a||/^(?:expires|max\-age|path|domain|secure)$/i.test(a))return!1;var d="";if(c)switch(c.constructor){case Number:d=Infinity===c?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+c;break;case String:d="; expires="+c;break;case Date:d="; expires="+c.toUTCString()}document.cookie=encodeURIComponent(a)+"="+encodeURIComponent(b)+d+(f?"; domain="+f:"")+(e?"; path="+e:"")+(g?"; secure":"");return!0},removeItem:function(a,b,c){if(!a||!this.hasItem(a))return!1;document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(c?"; domain="+c:"")+(b?"; path="+b:"");return!0},hasItem:function(a){return RegExp("(?:^|;\\s*)"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){for(var a=do

Three ingredients for a happy life

1. Work on something that is good for the world.

2. Be in a community where you experience deep love.

3. Redeem the events of your past.

🌈 🎈 🎉

🌈 🎈 🎉

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@swinton
swinton / serve.sh
Created July 8, 2014 16:19
Shell script to run a simple HTTP server from the current working directory.
#!/bin/bash
# Default port to serve on is 8800, to serve on another port, e.g. 3319:
# serve.sh 3319
port=${1-8800}
python -m SimpleHTTPServer $port
#!/usr/bin/env python
import sys
from django.template.defaultfilters import slugify
print slugify(sys.stdin.readline())
@swinton
swinton / sublime-settings.json
Created July 16, 2014 18:03
My Sublime Text 2 settings
{
"auto_complete": false,
"close_windows_when_empty": false,
"color_scheme": "Packages/Color Scheme - Default/Solarized (dark).tmTheme",
"draw_white_space": "all",
"find_selected_text": true,
"fold_buttons": true,
"folder_exclude_patterns":
[
".svn",
@swinton
swinton / villager.pde
Last active August 29, 2015 14:05
Minecraft villager. First Processing sketch, by Annabelle, aged 9. (I helped a little).
background(#ffffff);
size(400, 400);
// body
rect(276, 186, -127, 212);
rect(100, 186, 230, 73);
rect(100, 186, 230, 55);
// head
rect(276, 45, -127, 141);

Principles of Calm Technology

  1. Require the least amount of cognitive overhead

    A tea kettle can be set and forgotten, until it sings. It does not draw constant attention to itself until necessary. A tea kettle's whistle brings information from another room to one's attention.

  2. Provide information without distraction

An inner office window provides an understanding of whether someone is busy or not without the need to interrupt them.

@swinton
swinton / homework.md
Last active August 29, 2015 14:06
Coding to learn :: Homework, week 1

Task 1

Read the snippet of code below. Can you explain what is going on? How would you use this code to get the person's age?

// A person 'object'
var person = {};

// The person's date of birth (a date 'object')
person.dob = new Date("September 15, 1984");
@swinton
swinton / google-refine-operation-history.json
Created October 29, 2014 16:42
Google Refine history log that transposes a tweets.csv archive into a CSV that can be imported into Google Calendar.
[
{
"op": "core/column-addition",
"description": "Create column Start Date at index 4 based on column timestamp using expression grel:value",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"newColumnName": "Start Date",