Skip to content

Instantly share code, notes, and snippets.

View honzabrecka's full-sized avatar
👋

Honza Břečka honzabrecka

👋
View GitHub Profile
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)
const data = {
a: {
b: {
c: 10
}
}
}
const pipe = (fs) => (v) => fs.reduce((acc, f) => f(acc), v)
#!/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)))
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
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 = {
(extend-type object ILookup (-lookup [o k] (aget o k)))
...
(let [{:strs ["foo"]} #js {"foo" "bar"}])
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
@honzabrecka
honzabrecka / 0_reuse_code.js
Created July 1, 2017 10:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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
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