Skip to content

Instantly share code, notes, and snippets.

@jrudolph
jrudolph / TowersOfHanoi.scala
Created February 19, 2009 13:51
Scala-Metaprogramming: Towers of Hanoi
/*
* This is the Towers of Hanoi example from the prolog tutorial [1]
* converted into Scala, using implicits to unfold the algorithm at
* compile-time.
*
* [1] http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_3.html
*/
object TowersOfHanoi {
import scala.reflect.Manifest
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@bryanl
bryanl / tmux.conf
Created November 30, 2010 05:17
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@creationix
creationix / streamtest.js
Created January 1, 2011 08:57
A sample client for creationix/jsonparse that consumes the twitter feed and filters out messages and names
var Parser = require('./jsonparse');
var Http = require('http');
var p = new Parser();
// IMPORTANT, put your username and password in here
var username = "yourTwitterUsername", password = "yourPassword";
var client = Http.createClient(80, "stream.twitter.com");
var request = client.request("GET", "/1/statuses/sample.json", {
"Host": "stream.twitter.com",
"Authorization": (new Buffer(username + ":" + password)).toString("base64")
});
@max-mapper
max-mapper / awesome.html
Created May 12, 2011 15:37
node-serialport + arduino + popcorn.js DIY video scrubber
<html>
<head>
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://burritopizza.local/socket.io/socket.io.js"></script>
<script src="https://gist.github.com/raw/952547/f298c7e30d0978da0c78df0ff79436e883efbad2/gistfile1.txt"></script>
<script src="http://popcornjs.org/code/players/youtube/popcorn.youtube.js"></script>
<style type='text/css'>
body {
}
@jed
jed / LICENSE.txt
Created November 28, 2011 15:47 — forked from 140bytes/LICENSE.txt
turn the `new` keyword into a function
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@hcarty
hcarty / _tags
Created April 20, 2012 14:03
Lwt thread generation and consumption (now with zeromq)
<*.*>: package(lwt.unix), package(lwt.syntax), package(ZMQ), syntax(camlp4o)
(defn make-coll [x]
(cond
(coll? x) x
(nil? x) nil
:else (list x)))
(defn dragdrop [source-nodes target-nodes & {:keys [source-listeners target-listeners]}]
(let [source-group (goog.fx.DragDropGroup.)
target-group (goog.fx.DragDropGroup.)]
(doseq [source-node (make-coll source-nodes)]
(* Compiled-infered types in comments *)
module Lens = struct
(* 'a is "record" type, 'b is "field" type *)
type ('a, 'b) getter = 'a -> 'b
type ('a, 'b) setter = 'a -> 'b -> 'a
type ('a, 'b) lens = ('a, 'b) getter * ('a, 'b) setter
(* val read : ('a, 'b) lens -> 'a -> 'b *)
let read (l : ('a, 'b) lens) (a : 'a) : 'b = (fst l) a
(* val update : ('a, 'b) lens -> 'a -> 'b -> 'a *)
@lynaghk
lynaghk / 0-update.md
Last active July 5, 2022 13:33
Angular.js from ClojureScript