This file contains hidden or 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
;; now with an escape hatch! | |
(deftest home-page-flow | |
(naturally | |
(navigate to "/") | |
(click link "Sign In") | |
(fill in "Username" with $username, "Password" $password) | |
(click button "Sign In") | |
(expect page to have content "Welcome, " $username))) |
This file contains hidden or 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
;;; MrMusAddict's original function | |
(def charge-max 100.0) | |
(def charge-min 0.0) | |
(def bright-max 0.9) | |
(def bright-min 0.0) | |
;;; float brightFinal = (brightMin-brightMax)*Math.Pow((chargeCurrent-chargeMax)/(chargeMax-chargeMin), 4)+brightMax; | |
(defn mr-mus-addict |
This file contains hidden or 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 compile-unrolled | |
[f inputs] | |
(let [clauses (mapcat #(list % (f %)) inputs)] | |
`(fn [x#] | |
(case x# | |
~@clauses | |
(~f x#))))) | |
(defn unrolled | |
"Return a function with precomputed lookup for the given input domain." |
This file contains hidden or 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 stackity.stack) | |
(defn compile-mode? | |
[stack] | |
(-> stack meta :mode (= :compile))) | |
(def interpret-mode? (complement compile-mode?)) | |
(defn ->compile-mode | |
[stack] |
This file contains hidden or 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
;; an appropriate prelude... | |
(def parpar (partial partial partial)) | |
(def parapply (parpar apply)) | |
(def parconj (parpar conj)) | |
;; one convenient constant | |
(def char-offset (int \A)) |
This file contains hidden or 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
class Integer | |
def to_a | |
(0..Math.log2(self).ceil).map {|idx| self[idx] }.reverse | |
end | |
end |
This file contains hidden or 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
(defonce handlers (atom {})) | |
(defn- install-handler! | |
[topic-key f] | |
(swap! handlers assoc topic-key f)) | |
(defmacro on | |
"Registers a global message handler for the given topic keyword. A | |
single handler can be registered at a time for a given topic | |
keyword. Handlers are dispatched based on the name portion of the |
This file contains hidden or 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
function arrayAssocIn(obj, keys, val) { | |
var m = obj; | |
for (var ii = 0; ii < keys.length - 1; ii++) { | |
var k = keys[ii]; | |
m = m[k] = m[k] || []; | |
} | |
m[keys[keys.length - 1]] = val; | |
return obj; |
This file contains hidden or 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/bash | |
for branch in $(git branch --merged | grep -v '*') | |
do | |
read -n 1 -p "Delete ${branch} [y/N]? " answer | |
echo "" | |
if [[ "$answer" = "y" ]] | |
then | |
git branch -d "$branch" | |
fi |
This file contains hidden or 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/ruby | |
# uniq-live | |
# | |
# Reads from stdin or a given file and counts the number of times a | |
# given line repeats as it is read. | |
last = nil | |
count = 1 | |
while !ARGF.eof? && line = ARGF.readline.strip do |
OlderNewer