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
# Split an array in to n approximately equal pieces. | |
# | |
# Example usage: | |
# | |
# ('a'..'f').to_a.split_in_to(3) => [["a", "b"], ["c", "d"], ["e", "f"]] | |
# (1..7).to_a.split_in_to(2) => [[1, 2, 3, 4], [5, 6, 7]] | |
class Array | |
def split_into(pieces = 2) | |
len = self.count |
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
PROCESS_ID=`ps aux | grep rails | grep -v grep | cut -d ' ' -f3 | head -n 1` | |
if [[ -n "$PROCESS_ID" ]] | |
then | |
kill -9 $PROCESS_ID | |
echo "Derailing the train! $RANDOM passengers have died ..." | |
else | |
echo "No train in site." | |
fi |
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
ABACAS => #ABACA5 | |
ABASED => #ABA5ED | |
ABASES => #ABA5E5 | |
ABBESS => #ABBE55 | |
ABODED => #AB0DED | |
ABODES => #AB0DE5 | |
ACCEDE => #ACCEDE | |
ACCESS => #ACCE55 | |
ADOBES => #AD0BE5 | |
ADOBOS => #AD0B05 |
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
(defmacro SQL* [& clauses] | |
(let [query (walk/postwalk | |
(fn [x] | |
(if (and (symbol? x) (re-find #"^[A-Z]+$" (name x))) | |
(if (resolve x) | |
x | |
(str x)) | |
x)) clauses) | |
query (cons 'list query)] | |
`(join \space ~query))) |
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
(ns lorem-ipsum | |
(:require [clojure.string :as string])) | |
(def lorem-ipsum | |
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?") | |
(def sentences | |
(string/split lorem-ipsum #"(?<=[.?]) ")) | |
(defn random-sen |
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
(ns example.migration | |
(:require [example.table-util :as u] | |
[korma.core :as k])) | |
;; We need a table to help us keep track of the schema version so | |
;; whenever we migrate or rollback we know where we are before | |
;; executing any migration code. | |
;; | |
;; The `create-schema-migrations-table` function is called whenever a | |
;; migration or rollback is executed to make sure we have something to |
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
(defproject semantic-gs "0.1.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[compojure "1.1.5"] | |
[garden "0.1.0-beta5"] | |
[hiccup "1.0.3"]] | |
:plugins [[lein-ring "0.8.5"]] | |
:ring {:handler semantic-gs.handler/app} | |
:profiles | |
{:dev {:dependencies [[ring-mock "0.1.5"]]}}) |
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
(ns noprompt.cypher | |
(:require [clojure.string :as str] | |
[clojurewerkz.neocons.rest.cypher :as cy] | |
[clojure.walk :as walk]) | |
(:import java.lang.StringBuilder)) | |
;; Example usage: | |
(comment | |
;; Query: | |
(start {:n (node [3 1])} |
This file has been truncated, but you can view the full file.
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
(?:s(?:(?:u(?:b(?:(?:s(?:t(?:a(?:n(?:t(?:i(?:a(?:l(?:(?:i(?:s[mt]|a|ty|ze)|ly|ness))?|t(?:i(?:on|ve)|e|or)|bility)|v(?:e(?:(?:ly|ness))?|al(?:ly)?|i(?:ty|ze))|fy|ous|ze))?|c(?:e(?:less)?|h)|dard(?:ize)?)|lagmit(?:e|ic)|ge|tion)|r(?:a(?:t(?:o(?:s(?:pher(?:e|ic)|e)|r)|i(?:ve)?|al|e|um)|ct(?:ion)?)|uct(?:(?:ion(?:al)?|ur(?:al|e)))?|iate)|itu(?:t(?:i(?:on(?:a(?:l(?:ly)?|ry))?|ng(?:ly)?|ve(?:ly)?)|e(?:[dr])?|able)|ent)|o(?:r(?:eroom|y)|ck)|yl(?:ar|e)|ernal)|e(?:[ta]|r(?:v(?:i(?:en(?:t(?:(?:ly|ness))?|c[ey])|ate)|e)|o(?:sa|us)|ies|rate)|c(?:u(?:t(?:e|ive)|rity)|retar(?:ial|y)|t(?:ion)?|ive)|quen(?:t(?:(?:ial(?:ly)?|ly|ness))?|c[ey])|ns(?:u(?:al|ous)|ation|ible)|pt(?:uple)?|mi(?:fusa|tone)|xtuple|wer|ssile|gment)|i(?:d(?:i(?:ar(?:i(?:e|ly|ness)|y)|z(?:a(?:ble|tion)|e(?:r)?)|ng|st)|e(?:(?:n(?:c[ey]|t)|r))?|y)|st(?:(?:en(?:c[ey]|t(?:ial)?)|ingly))?|l(?:ic(?:ate|ic)|l)|m(?:i(?:lation|ous)|ple)|zar(?:ship)?|nuous)|c(?:ri(?:pt(?:(?:i(?:on(?:ist)?|ve(?:ly)?)|ure))?|b(?:e(?:r(?:ship)?)?|able)|ve(?:r)?)|apular(?:(?:is|y))?| |
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
(ns clojurescript.console.macros | |
(:refer-clojure :exclude [time])) | |
(defmacro with-group [title & body] | |
`(do | |
(.group js/console ~title) | |
~@body | |
(.groupEnd js/console))) | |
(defmacro with-group-collpased [title & body] |
OlderNewer