Skip to content

Instantly share code, notes, and snippets.

View fogus's full-sized avatar
💭
attempting to learn how to better learn

Fogus fogus

💭
attempting to learn how to better learn
View GitHub Profile
@fogus
fogus / gist:6509493
Created September 10, 2013 13:35 — forked from samaaron/gist:6509442
require 'thread'
module SonicPi
class Promise
VAL_SEM = Mutex.new
PUSH_SEM = Mutex.new
def initialize
@box = Queue.new
function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import shapeless._, HList._
import shapeless._
import HList._
scala> "foo" :: 124 :: HNil
res0: shapeless.::[java.lang.String,shapeless.::[Int,shapeless.HNil]] = foo :: 124 :: HNil
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every

The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."

Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and

(def cds (collection))
;; interact with database
(go
(>! (:in cds)
{:op :create
:val {:title "Soft Machine Vol. 1"
:artist "Soft Machine"
:year 1969}})
@fogus
fogus / quil-wtf.clj
Last active December 19, 2015 03:18 — forked from gilesbowkett/quil-wtf.clj
(ns circles.core
(:require [quil.core :as q]))
; "hello world" for Quil meets http://bit.ly/18luJO2
(def the-width 808)
(def the-height 500)
(defn random-x-y []
(list (int (rand the-width))
(let [x true
y true
z true]
(match [x y z]
[_ false true] 1
[false true _ ] 2
[_ _ false] 3
[_ _ true] 4
:else 5))