Skip to content

Instantly share code, notes, and snippets.

View jnbek's full-sized avatar

John D Jones III jnbek

View GitHub Profile
@jnbek
jnbek / clojure-match.clj
Created September 13, 2012 16:33 — forked from ckirkendall/clojure-match.clj
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
ss23@Crisp /etc/init.d $ cat vixie-cron
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/vixie-cron.rc7,v 1.1 2011/12/31 14:58:21 idl0r Exp $
command=/usr/sbin/cron
pidfile=/var/run/cron.pid
depend() {
@jnbek
jnbek / gist:3218045
Created July 31, 2012 15:58
~/bin/dirty
# I want a tool that tells me what my modified files are, whether I'm in a Subversion or Git project.
# I want to be able to say vim $(dirty)
#!/usr/bin/perl
use warnings;
use strict;
my @lines = qx/svn status 2>&1/;
exit if @lines == 0;
@jnbek
jnbek / hasProperty.js
Created November 14, 2011 17:10 — forked from ryanflorence/hasProperty.js
See if an object has a property
var has = function (obj, property) {
var tree = obj,
split = property.split('.'),
last = split.pop();
while (next = split.shift()) {
tree = tree[next];
if (tree === undefined) return false;
}