Skip to content

Instantly share code, notes, and snippets.

set clipboard+=unnamed
// Minimal unit testing for Rhino
// loosely based off minunit - http://www.jera.com/techinfo/jtns/jtn002.html
// same license as minunit - do whatever you want with no warranty
var jstest = function () {
var pub = {};
var currentSuite = "DefaultSuite";
pub.testsRun = 0;
pub.assert = function (message, test) {
@jmingtan
jmingtan / premake4.lua
Created October 22, 2010 17:52
premake4 script for UnitTest++
solution "UnitTest++"
platforms { "x32" }
configurations { "Release" }
build_dir = "build"
targetdir(build_dir)
objdir(build_dir)
location(build_dir)
configuration { "macosx" }
@jmingtan
jmingtan / premake4.lua
Created October 25, 2010 14:24
Premake4 script for libRocket
-- premake4 build file for libRocket http://librocket.com
--
-- edit the includedirs section to point to your local freetype2 folder.
--
-- originally written for a OSX and homebrew-based system
solution "libRocket"
configurations { "Release" }
platforms { "x32" }
@jmingtan
jmingtan / import.py
Created April 27, 2011 09:58
Import repos
import os
import os.path
import sys
def is_mercurial(directory):
"""Tests whether a given path contains a .hg folder."""
hg_path = os.path.join(directory, ".hg")
return os.path.isdir(hg_path)
def checkout(directory):
@jmingtan
jmingtan / autoreload.py
Created August 25, 2011 17:52
Autoreload is a simple python script to watch a directory for changed files and restarts a process when the change is detected.
#!/usr/bin/env python
""" An extension of Steve Krenzel's autoreload script (https://github.com/stevekrenzel/autoreload)
Changes:
1. Allow user specified file extension white lists
2. Check if a process is alive before killing it
What follows is the original README.md file:
@jmingtan
jmingtan / config.el
Created November 19, 2012 04:29
emacs config
;; GUI configuration
(blink-cursor-mode 1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
;; Escape key mod
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
;; ido mode configuration
(ido-mode 1)
@jmingtan
jmingtan / gist:6319600
Created August 23, 2013 13:57
Setup libgdx in Clojure
; from https://github.com/SilverCrowBlog/Clojure-Libgdx
; project.clj
(defproject testing "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[com.badlogic.gdx/gdx "0.9.9-SNAPSHOT"]
@jmingtan
jmingtan / Dockerfile
Created February 21, 2015 17:16
Dockerfile for Boot (http://boot-clj.com/)
FROM clojure
ENV BOOT_AS_ROOT=yes
RUN wget https://github.com/boot-clj/boot/releases/download/2.0.0-rc9/boot.sh
RUN mv boot.sh boot && chmod a+x boot && mv boot /usr/local/bin
RUN boot
@jmingtan
jmingtan / interview.clj
Created July 4, 2015 05:00
Find longest increasing subsequence in a sequence of random numbers
(ns interview.core)
(defn gen-seq
"Generates a random seq of numbers"
[n]
(for [_ (range n)]
(inc (rand-int 10))))
(defn find-longest-seq
"Find longest increasing subsequence"