- Cabal
- Starting a new project
- Sandboxes
- Creating
- Deleting
- Adding dependencies
- Installing dependencies
- Adding one or more test suites
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 ANYTHING CABAL HAS EVER DROPPED ONTO YOUR SYSTEM | |
rm -rf ~/.{ghc,cabal} | |
# UPDATE CABAL | |
cabal update | |
# UPGRADE CABAL TO 1.18 (BECAUSE THEY ADDED SANDBOXES) | |
cabal install cabal-install | |
export PATH=~/.cabal/bin:$PATH ;# PUT THIS IN YOUR PROFILE |
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
# If your workers are inactive for a long period of time, they'll lose | |
# their MySQL connection. | |
# | |
# This hack ensures we re-connect whenever a connection is | |
# lost. Because, really. why not? | |
# | |
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
# | |
# From: | |
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
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
### | |
# Read in XML as a stream, write out JSON as a stream. As little information | |
# is kept in memory as possible. | |
require 'nokogiri' | |
require 'psych' | |
class JSONTranslator < Nokogiri::XML::SAX::Document | |
attr_reader :emitter | |
def initialize emitter |
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 ruby | |
require 'FileUtils' | |
require 'date' | |
def create_dir_if_necessary(path) | |
Dir.mkdir(path) unless File.directory?(path) | |
end | |
desktops_path = File.expand_path("~/Dropbox/Documents/Desktops") |
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
(def cds (collection)) | |
;; interact with database | |
(go | |
(>! (:in cds) | |
{:op :create | |
:val {:title "Soft Machine Vol. 1" | |
:artist "Soft Machine" | |
:year 1969}}) |
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 take-until | |
([pred-sentinel in] (take-until pred-sentinel in (chan))) | |
([pred-sentinel in out] | |
(go (loop [] | |
(if-let [v (<! in)] | |
(do | |
(>! out v) | |
(if-not (pred-sentinel v) | |
(recur) | |
(close! out))) |
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
2013-09-05 23:24:37.777 Prime[4204:c07] 1 | |
2013-09-05 23:24:37.779 Prime[4204:c07] 0.732028842267092 | |
2013-09-05 23:24:37.780 Prime[4204:c07] 0.2530017011838238 | |
2013-09-05 23:24:37.781 Prime[4204:c07] 0.22892546997679017 | |
2013-09-05 23:24:37.781 Prime[4204:c07] 0.5423003204364027 | |
2013-09-05 23:24:37.782 Prime[4204:c07] 0.6065306597126334 | |
2013-09-05 23:24:37.783 Prime[4204:c07] 0.44399788140114904 | |
2013-09-05 23:24:37.783 Prime[4204:c07] 0.15345314921321815 | |
2013-09-05 23:24:37.784 Prime[4204:c07] 0.13885046809469812 | |
2013-09-05 23:24:37.784 Prime[4204:c07] 0.32892187595578626 |
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 create-type | |
"Extract a type from provided field idents stored in Datomic database at uri." | |
[uri type-name overrides] | |
(let [c (d/connect uri) | |
d (d/db c) | |
datomic-type-map {:db.type/string 'String | |
:db.type/ref 'Any} | |
mt (dt/q> :- [EntityID] | |
'[:find ?e | |
:in $ ?t-name |
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 | |
# clear old pipe and lock | |
rmdir worklock 2>/dev/null | |
rm work | |
if [[ ! -p work ]]; then | |
mkfifo work | |
else | |
dd if=work of=/dev/null |
OlderNewer