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
tmux new-session -s kuali -n cm-proto -d | |
tmux send-keys -t kuali 'cd cm-prototype' C-m | |
tmux split-window -v -p 20 -t kuali | |
tmux select-layout -t kuali main-vertical | |
tmux send-keys -t kuali:cm-proto.0 'vim .' C-m | |
tmux send-keys -t kuali:cm-proto.1 'cd cm-prototype && npm run hmr' C-m | |
tmux resize-pane -Z -t kuali:cm-proto.0 | |
tmux attach -t kuali |
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
{-# LANGUAGE DeriveGeneric #} | |
data User = User { | |
id :: String, | |
email :: String, | |
hash :: String, | |
institutionId :: String | |
} deriving (Show, Generic) | |
data UserPrintable = UserPrintable { |
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
function* generator() { | |
yield 1; | |
yield 2; | |
yield 3; | |
yield 4; | |
} | |
var i = generator(); | |
var next = {}; | |
while (!next.done) { |
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
function quicksort(list) { | |
if (list.length == 0) { | |
return list; | |
} | |
var pivot = list.splice(Math.floor(list.length / 2), 1)[0]; | |
var smaller = quicksort(list.filter(function(i) { | |
return i <= pivot; | |
})); | |
var larger = quicksort(list.filter(function(i) { |
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
-- see http://learnyouahaskell.com/recursion#quick-sort | |
quicksort' :: (Ord a) => [a] -> [a] | |
quicksort' [] = [] | |
quicksort' (x:xs) = | |
let biggerSorted = quicksort' [a | a <- xs, a > x] | |
smallerSorted = quicksort' [a | a <- xs, a <= x] | |
in smallerSorted ++ [x] ++ biggerSorted |
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
f :: Int -> [Int] -> [Int] | |
f n arr = -- Complete this function | |
concat $ map (makeN n) arr | |
makeN :: Int -> (Int -> [Int]) | |
makeN n = | |
(\x -> map (\i -> x) [1..n]) | |
-- This part handles the Input and Output and can be used as it is. Do not modify this part. |
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 products-of-ints [nums] | |
"Takes an array of integers and returns an array of integers where the | |
element at each index is the product of all the other elements except the | |
element at that index multiplied." | |
(let [product-of-every-num (reduce * nums)] | |
(map #(/ product-of-every-num %) nums))) |
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
var React = require('react'); | |
var History = require('immutable-history'); | |
// call `render` whenever the cursor changes | |
var state = new History({posts: [], username: 'Jamitron The Terrible'}, render); | |
var App = React.createClass({ | |
render: function() { | |
var postsCursor = this.props.data.cursor(['posts']); | |
return <div> |
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 decrement-char-count [char-map character] | |
(let [new-char-map (assoc char-map character (dec (get char-map character 0)))] | |
[(new-char-map character) new-char-map])) | |
(defn make-char-map [string] | |
(reduce (fn [char-map character] (assoc char-map character (inc (get char-map character 0)))) {} (seq string))) | |
(defn permutation? [str1 str2] | |
"return true if str2 can be formed by some permutation of str1, false otherwise" | |
(let [str1-map (make-char-map str1)] |
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 durp.handler | |
(:require [compojure.core :as cc] | |
[compojure.handler :as handler] | |
[ring.util.response :refer [response]] | |
[ring.middleware.json :as json])) | |
(cc/defroutes app-routes | |
(cc/POST "/user/:user-id" [user-id {:body body}] (response (body)))) | |
(def app |