This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
## Copyright (c) 2011, Kapil Reddy | |
## All rights reserved. | |
## Redistribution and use in source and binary forms, with or without | |
## modification, are permitted provided that the following conditions are met: | |
## * Redistributions of source code must retain the above copyright | |
## notice, this list of conditions and the following disclaimer. | |
## * Redistributions in binary form must reproduce the above copyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn [query-map] | |
(str "?" (apply str (map name (flatten (interpose :& (map #(interpose "=" %) (seq query-map)))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'flymake) | |
(defun flymake-php-init () | |
"Use php to check the syntax of the current file." | |
(let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) | |
(local (file-relative-name temp (file-name-directory buffer-file-name)))) | |
(list "php" (list "-f" local "-l")))) | |
(add-to-list 'flymake-err-line-patterns | |
'("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A pre-commit hook for js and clojure | |
# It runs jshint on js files. | |
# and runs lein2 midje. | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A pre-commit hook for js | |
# It runs jshint on js files. | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(remove-hook 'clojure-mode-hook 'clojure-test-maybe-enable) | |
(defun clojure-in-tests-p () | |
(or (string-match-p "test\." (clojure-find-ns)) | |
(string-match-p "/test" (buffer-file-name)))) | |
(defun midje-test-for (namespace) | |
(let* ((namespace (clojure-underscores-for-hyphens namespace)) | |
(segments (split-string namespace "\\.")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Prints terminal codes. | |
# | |
# Thanks to: http://github.com/wayneeseguin/rvm/blob/master/scripts/color | |
# | |
# @param [String] terminal code keyword (usually a color) | |
bput() { | |
case "$1" in | |
# regular colors | |
black) tput setaf 0 ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn find-surviver* | |
[in] | |
(loop [[f s & coll] in] | |
(if (and f s) | |
(recur (concat coll [f])) | |
f))) | |
(defn find-surviver | |
[population] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn publish | |
([a & ch-vals] | |
(let [key-vals (mapcat (fn [[channel val]] | |
[channel {:val val | |
:id (java.util.UUID/randomUUID)}]) | |
(partition 2 ch-vals))] | |
(apply swap! a assoc key-vals)))) | |
(defn subscribe |
OlderNewer