Skip to content

Instantly share code, notes, and snippets.

View ddellacosta's full-sized avatar

Dave Della Costa ddellacosta

View GitHub Profile
(defun cider-with-profile (profile)
"Starts up a cider repl using jack-in with the specific lein profile
selected."
(interactive "sProfile: \ns")
(let* ((profile-str (symbol-name profile))
(profile-str (replace-regexp-in-string ":\\(.*\\)$" "\\1" profile-str))
(lein-params (concat "with-profile +" profile-str " repl :headless")))
(setq cider-lein-parameters lein-params)
(cider-jack-in)))
(ns my.namespace
(:require
[com.stuartsierra.component :as component]))
(defrecord ExampleComponent [options foo]
component/Lifecycle
(start [this]
(println ";; Starting ExampleComponent")
;; In the 'start' method, a component may assume that its
@ddellacosta
ddellacosta / gist:5cb1ea73fbe67dce1acf
Last active August 29, 2015 14:20
No idea if this actually works, but should be something like this
(ns some-namespace
(:require
[om.core :as om]
[om.dom :as dom]))
(defn time-widget
[{:keys [msg-time] :as msg} owner]
(reify
om/IRenderState
(render-state [_ _]
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-- Generates a single diamond line with the alphabet char in the right position.
dline :: Int -> Int -> Int -> [Char] -> [Char] -> [Char]
dline len idx idx2 as ls
| idx2 == (succ len) = ls ++ (reverse . init) ls
| idx2 == idx = (dline len idx (succ idx2) as (ls ++ [(as !! (len - idx2))]))
| otherwise = (dline len idx (succ idx2) as (ls ++ "-"))
(ns diamond.core)
(def alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
(defn append-end
"Takes a diamond string and appends the reverse of the string minus
first char, so i.e. ---A becomes ---A---, D--- becomes D-----D, etc."
[s]
(str s (apply str (reverse (butlast s)))))
$ gem install riemann-tools
Building native extensions. This could take a while...
ERROR: Error installing riemann-tools:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin13/ruby/config.h', needed by `yajl.o'. Stop.
import Data.List
import Data.Map
-- Aluminum = alum
-- Copper = copper
-- Iron = iron
-- Blue = blue
-- Grey = grey
-- Textured = textured
-- Coated = coated
(λx.P)[x := N] = λx.P;
(λy.P)[x := N] = λy.P[x := N], if y ̸∈ FV(N) or x ̸∈ FV(P);
(λy.P)[x := N] = λz.P[y := z][x := N], if y ∈ FV(N) and x ∈ FV(P).
$ runhaskell W1Test.hs
Impl/Test.hs:31:3: Warning:
In the use of ‘printTestCase’
(imported from Test.QuickCheck.Property):
Deprecated: "Use counterexample instead"
W1Test.hs:39:33:
Ambiguous occurrence ‘===’
It could refer to either ‘Impl.Test.===’,
@ddellacosta
ddellacosta / I am going insane
Last active August 29, 2015 14:06
I am going insane
user=> keys-as-str
"#{\"CostCenterOfficeCode\" \"CostCenterFirmFunctionMediumDesc\" \"Date_LastDayWorked\" \"CostCenterOfficeDesc\" \"JobLevelText\" \"FacilityRegionCode\" \"Name_Last\" \"CostCenterServiceLineCode\" \"Date_MostRecentHire\" \"CompanyCodeDesc\" \"CostCenterServiceLineDesc\" \"PersonnelAreaDesc\" \"MasterCostCenterName\" \"CostCenterServiceAreaMediumDesc\" \"Name_PreferredFirst\" \"FacilityRegionDesc\" \"FacilityCode\" \"Date_Valid_From\" \"PersonnelSubareaCode\" \"FacilityName\" \"Date_Valid_To\" \"PersonnelSubareaDesc\" \"CostCenterServiceAreaCode\" \"Date_OriginalHire\" \"Email_Address\" \"Name_OutlookDisplayName\" \"EmployeeGroupDesc\" \"JobText\" \"IsPPD\" \"PersonnelAreaCode\" \"PreferredFullName\" \"IsManager\" \"CostCenterFirmFunctionCode\" \"Name_Middle\" \"EmployeeGroupCode\" \"Date_EmployeeTerminated\" \"JobLevelCode\" \"EmployeeAlias\" \"Phone_Desk\" \"PersonnelNbr\" \"Date_PartnerTerminated\" \"Addr_PersonnelAreaOfficeCity\" \"CompanyCode\" \"Name_First\" \"MasterCostCenterNumber\"}