This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include "list.h" | |
typedef struct episode { | |
int epid; | |
struct list_head list; | |
} episode_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var mysql = require('mysql'); | |
var app = express(); | |
/// | |
/// Create connection to MySQL database server. | |
/// | |
function getMySQLConnection() { | |
return mysql.createConnection({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- OverloadedStrings is often useful. | |
:set -XOverloadedStrings | |
-- Scoped type variables is often useful so we can specify the types | |
-- of variables (for example, in lambda expressions). | |
:set -XScopedTypeVariables | |
-- useful for import from specified package | |
:set -XPackageImports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md)) | |
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md)) | |
all : $(SLIDES) $(HANDOUTS) | |
%.md.slides.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -o $@ | |
%.md.handout.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -V handout -o $@ |
pandoc-quick-ref.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python | |
import urllib,json | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument( 'subreddit', nargs=1,help="Subreddit to browse, f.e. programming") | |
args= parser.parse_args() | |
subreddit = args.subreddit[0] | |
a = urllib.urlopen('http://www.reddit.com/r/'+str(subreddit)+'/.json') | |
try: |
Let's say you start a project locally, and do some editing.
$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE
Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Regular fibonacci *) | |
fun fib 0 = 0 | |
| fib 1 = 1 | |
| fib n = fib (n-1) + fib (n-2); | |
(* Fibonacci using closures for memoization *) | |
local | |
fun fib_c f n = | |
case f n of | |
SOME v => (v, f) |