Skip to content

Instantly share code, notes, and snippets.

View sylvainmathieu's full-sized avatar

Sylvain Mathieu sylvainmathieu

View GitHub Profile
@sylvainmathieu
sylvainmathieu / gist:e846e85f847215096ebc
Created January 13, 2015 16:40
Switch easily between JDKs on OSx (to include in ~/.profile)
# Usage: `setjdk 1.7` or `setjdk 1.8`
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
import 'dart:html';
import 'dart:math';
import 'dart:async';
var ctx;
List<Point> snake = [new Point(12, 10)];
Point direction = new Point(1, 0);
Point food;
void main() {
state =
dir: x: 1, y: 0
canvas = ->
can = document.getElementById("game")
ctx = can.getContext("2d")
width = can.width
height = can.height
ctx.fillStyle = "black"
(ns hello-cljs.main)
(defn log [str]
(.log js/console str))
(def state (atom {:direction [1 0]}))
(defn canvas []
(let [canvas (.getElementById js/document "game")
ctx (.getContext canvas "2d")
@sylvainmathieu
sylvainmathieu / Snake.scala
Created October 16, 2011 19:27
Scala experiments
package snake
import scala.util.{Random}
import swing.{SimpleSwingApplication, MainFrame, Panel, event}
import event.{KeyPressed}
object App extends SimpleSwingApplication {
import event.Key._
import java.awt.{Dimension, Graphics2D, Rectangle}
import java.awt.{Color}