This file contains hidden or 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
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
# twitter command line client | |
# That's What I Call Lame | |
# 09nov2008 +chris+ | |
require 'json' | |
require 'open-uri' |
This file contains hidden or 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
/* merge sort in js */ | |
function sort(a) { | |
var mid = a.length>>1; | |
if (mid==0) return a; | |
var less = sort(a.slice(0,mid)); | |
var more = sort(a.slice(mid)); | |
var merged = []; | |
do { | |
if (more[0] < less[0]) { var t=less; less=more; more=t; } | |
merged.push(less.shift()); |
This file contains hidden or 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
""" | |
This modules implements a rudimentary prolog engine. Its | |
purpose is to illustrate the use of continuations to program | |
a search engine with backtracking and cut. | |
""" | |
def bind(var,term,alist): | |
"""bind var to term in environment alist. return the updated | |
environment. we make a copy so that we don't have to undo on | |
backtracking (in essence: we always trail).""" |
This file contains hidden or 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
(comment | |
Features: | |
- One monster type: Zombies! | |
- Teleporters | |
- Artificial Unintelligence technology for realistic zombie horde | |
behavior | |
- Full in-game documentation | |
- Trees | |
- Gold (because really, what's a roguelike without gold?) | |
- Each game is guaranteed to end in death by zombie |
This file contains hidden or 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
'''Digital image steganography based on the Python Imaging Library (PIL) | |
from http://wordaligned.org/articles/steganography | |
Any message can be hidden, provided the image is large enough. The message is | |
packed into the least significant bits of the pixel colour bands. A 4 byte | |
header (packed in the same way) carries the message payload length. | |
''' | |
import Image | |
import itertools as its | |
def n_at_a_time(items, n, fillvalue): |
This file contains hidden or 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
#!/bin/sh | |
# to post `cat file | gist.sh` | |
# or `gist.sh < file` | |
# to get `gist.sh 1234` | |
log () | |
{ | |
echo "$@" >&2 | |
} |
This file contains hidden or 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
// Totally stolen from http://logand.com/sw/jmultimethod/ | |
// Multi.java | |
@Target(ElementType.METHOD) | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface Multi { | |
public String value(); | |
} | |
This file contains hidden or 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
// Example for http://gist.github.com/51089 | |
public class CarTest { | |
interface CarElement {} | |
class Wheel implements CarElement { | |
private String name; | |
Wheel(String name) { | |
this.name = name; |
This file contains hidden or 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
// Example for http://gist.github.com/51089 | |
public class AsteroidTest { | |
class Asteroid {} | |
class Spaceship {} | |
@Multi("collide") | |
public void collideOO(Object X, Object Y) { |
This file contains hidden or 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
;; a bit faster flatten | |
(defn flatten [x] | |
(if (seq? x) | |
(lazy-seq (apply #(lazy-cat %&) (map flatten x))) | |
(list x))) | |
OlderNewer