Skip to content

Instantly share code, notes, and snippets.

@jmingtan
jmingtan / deps.edn
Created April 14, 2018 03:16
Clojure CLI setup with rebel-readline and cider middleware
{:aliases
{:dev {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.2"}
org.clojure/tools.nrepl {:mvn/version "0.2.12"}
cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}
:main-opts ["-m" "repl"]}}}
@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"
@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 / 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 / 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 / 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 / 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 / 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 / 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" }
// 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) {