Skip to content

Instantly share code, notes, and snippets.

import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
n :: [Normal3 GLfloat]
n = [(Normal3 (-1.0) 0.0 0.0),
(Normal3 0.0 1.0 0.0),
(Normal3 1.0 0.0 0.0),
(Normal3 0.0 (-1.0) 0.0),
(Normal3 0.0 0.0 1.0),
(Normal3 0.0 0.0 (-1.0))]
-- file: QuickPiet.hs
-- An implementation of QuickPiet by Ben Lee
-- based on the Piet language by ???
-- I haven't tested this code, but if you'd like to, then the following will get you on your way:
-- $ ghc --make QuickPiet.hs
-- $ ./QuickPiet filename
-- where filename is some script file you want to run
-- Good Luck!
(ns revelytix.test-triplestore
(:use [reveltix.triplestore :only (*connection* connect-to dispose execute-command resultMessage= create-graph drop-graph insert-triple load-file)]))
(def *HOST* "rmi://australia/server1")
(def *FAMILY* "family")
(def *N3_FAMILY_FILE* "test/data/family.n3")
(def *SELECT-ALL* "select ?s ?p ?o where { ?s ?p ?o }")
;; Connection Fixture, establishes a connection for all execute-command calls to use
(defn connection-fixture [f]
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
@youngnh
youngnh / gist:655752
Created October 30, 2010 21:17
pallet_simple.clj
(ns pallet-simple
(:use [pallet core compute resource])
(:use [pallet.crate.automated-admin-user])
(:use [pallet.crate.couchdb :only (couchdb)])
(:use [pallet.crate.java :only (java)])
(:use [pallet.crate.jetty :only (jetty)]))
(def ec2-access-id "Your-Access-ID-Here")
(def ec2-secret-key "Your-Secret-Key-Here")
@youngnh
youngnh / gist:872757
Created March 16, 2011 16:22
wtf.clj
(fn [m]
(let [keys (set (keys m))
key-map (into {} (for [k keys] [k k]))]
(select-keys m (vals key-map))))
@youngnh
youngnh / Display.java
Created April 7, 2011 02:46 — forked from anonymous/Display.java
Main.java
// This class does something with the board. I don't completely understand it, our teacher wrote it
package ui;
import centipede.Main;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import javax.swing.JTextArea;
@youngnh
youngnh / full_stack_test.clj
Created April 7, 2011 14:28
Quick test for Exception causes in wrap-stacktrace
(use 'ring.middleware.stacktrace)
(defn buggy [_]
(throw (Exception. "splork")))
(defn roachy [req]
(try
(buggy req)
(catch Exception e
(throw (Exception. "splunch" e)))))
@youngnh
youngnh / api.clj
Created September 6, 2011 18:53
State Monad
(ns revelytix.spyder.query.interface
(:require [revelytix.sparql.parse :as sparqlp]
[revelytix.spyder.query.plan :as plan]
[revelytix.spyder.query.optimize :as opt]
[revelytix.spyder.query.process :as process]
[revelytix.spyder.log :as log])
(:import [revelytix.spyder.query.api QueryException]
[revelytix.spyder.sql.plan_tree QueryContext]))
(defn always [x]
@youngnh
youngnh / gist:4177670
Created November 30, 2012 18:45
Starting Plan
(query+ (frame+ {:column-metadata {"x" {:datatype :uri
:expression :one-to-one}}
:alias "topframe__1"
:source "topframe"}
(distinct+)
(project+ [x id])
(bind+ {x (new-function
{:op "iri"
:args [(new-function
{:op "http://www.w3.org/2005/xpath-functions#concat"