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
| const ask = (questions, end) => (response, convo) => { | |
| let responses = {} | |
| const $ask = (questions) => { | |
| const {id, question, validate} = questions.shift() | |
| convo.ask(question, (response, convo) => { | |
| try { | |
| responses[id] = response | |
| typeof validate === 'function' && validate(response, responses) |
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
| const data = { | |
| a: { | |
| b: { | |
| c: 10 | |
| } | |
| } | |
| } | |
| const pipe = (fs) => (v) => fs.reduce((acc, f) => f(acc), v) |
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/env planck | |
| (ns honza.svg2rn | |
| (:require [planck.core :as core] | |
| [clojure.string :as s])) | |
| (defn camel-case [s] | |
| (let [[a & ab] (s/split s #"-")] | |
| (reduce #(str %1 (s/capitalize %2)) a ab))) |
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
| module.exports = function(config) { | |
| var root = 'target/public/dev'// same as :output-dir | |
| config.set({ | |
| frameworks: ['cljs-test'], | |
| files: [ | |
| root + '/goog/base.js', | |
| root + '/cljs_deps.js', | |
| root + '/app.js',// same as :output-to |
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
| const http = require('http') | |
| const fs = require('fs') | |
| const express = require('express') | |
| const app = express() | |
| app.use('/proxy', (req, res) => { | |
| const headers = req.headers | |
| delete headers['host'] | |
| const options = { |
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
| (extend-type object ILookup (-lookup [o k] (aget o k))) | |
| ... | |
| (let [{:strs ["foo"]} #js {"foo" "bar"}]) |
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
| enum Flags { | |
| A = 1, | |
| B = 2, | |
| C = 4 | |
| } | |
| // number means uint | |
| const allowed = (flags: number, flag: Flags): boolean => (flags & flag) === flag | |
| const allowedFlags = Flags.B | Flags.C |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 reduce(f, init, col) { | |
| let result = init | |
| for (i = 0; i < col.length; i++) | |
| result = f(result, col[i], i, col) | |
| return result | |
| } | |
| function recursiveReduce(f, init, col) { | |
| function $(i, result) { | |
| return i === col.length |
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
| module Problem1 where | |
| import Prelude | |
| import Data.List | |
| isIncreasing :: List Int -> Boolean | |
| isIncreasing Nil = true | |
| isIncreasing (_ : Nil) = true | |
| isIncreasing (x : y : ys) | x < y = isIncreasing (y : ys) | |
| | otherwise = false |