Skip to content

Instantly share code, notes, and snippets.

View wilkes's full-sized avatar

Wilkes Joiner wilkes

View GitHub Profile
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
# terminal
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " ☠ "
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
export PS1='\u@\h \W$(__git_ps1 "|")$(parse_git_branch)$ '
#export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
(defn current-iterations [projects-and-iterations]
(current-by
"Project"
(map (fn [[p [i]]]
{(-> p :project :name)
(-> i :iteration :stories)})
projects-and-iterations)))
(defn perfect-number? [x]
(and (> x 0)
(== (apply + (filter #(= (rem x %) 0) (range 1 (inc x))))
x)))
(defn list-perfs [num]
(filter perfect-number? (range num)))
(defn fact2 [x]
(let [x (if (<= x 1) 1 x)]
(apply * x (range 1 x))))
(ns github-clj
(:use clojure.contrib.json.read)
(:require [clojure.http.client :as http]))
;; List all repose GET repos/show/:user
(defn auth-info [login token]
(http/url-encode {"login" login "token" token}))
(def base-url "http://github.com/api/v2/json/")
(ns backup-user
(:use github-clj
[clojure.contrib.pprint :only [pprint]]
[clojure.contrib.shell-out :only [sh]])
(:import [java.io File]))
(defn clone-repo [repo dir]
(sh "git" "clone"
(format "[email protected]:%s/%s.git"
(:owner repo) (:name repo))
@wilkes
wilkes / core.clj
Created June 3, 2010 21:14 — forked from bhenry/core.clj
(ns attendance.core
(:use karras.core
karras.collection
karras.sugar
compojure.core
ring.adapter.jetty
hiccup.core)
(:require [compojure.route :as route]))
(defn home []
(deftest using-hooke
(let [count (atom 0)]
(defn log-create [f & args]
(let [result (apply f args)]
(when (= Company (first args))
(swap! count inc))
result))
(add-hook #'create log-create)