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
;; | |
;; http://johnj.com/from-elegance-to-speed.html | |
;; | |
;; The Clojure version | |
;; ------------------- | |
(ns smt | |
(:require [net.cgrand.xforms :as x] | |
[criterium.core :as c :refer [quick-bench]])) |
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
#!/usr/bin/env bash | |
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error | |
# Make sure that the .gnupg directory and its contents is accessibile by your user. | |
chown -R $(whoami) ~/.gnupg/ | |
# Also correct the permissions and access rights on the directory | |
chmod 600 ~/.gnupg/* | |
chmod 700 ~/.gnupg |
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 left-join | |
"When passed 2 rels, returns the rel corresponding to the natural | |
left-join. When passed an additional keymap, joins on the corresponding | |
keys." | |
([xrel yrel] | |
(if (and (seq xrel) (seq yrel)) | |
(let [ks (intersection (set (keys (first xrel))) | |
(set (keys (first yrel)))) | |
idx (index yrel ks)] | |
(reduce (fn [ret x] |
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
version: '2' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:3.3.0 | |
hostname: zookeeper | |
ports: | |
- "2181:2181" | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 |
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
class Movie { | |
String name | |
URL url | |
} | |
def downloads = new File('downloads') | |
downloads.mkdirs() | |
"http://portal.regiojet.cz/files/movies/".toURL().text.findAll(~/(?<=href=")([\S^"]*)(?=")/) | |
.parallelStream() |
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
#lang racket | |
;; Fusable Streams, after Coutts, Leshchinskiy and Stewart 2007. | |
;; Haskell: | |
;; data Stream a where Stream :: (s -> Step s a) -> s -> Stream a | |
;; data Step s a = Yield a s | Skip s | Done | |
;; Clojure transducers support: | |
;; - early termination | |
;; - completion cleanup |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
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
; note: this iteration doesn't work properly. | |
; looks like i don't understand exactly how react.js works for settings dom element properties | |
(set! exports {}) | |
; react macros... | |
(defmacro hash-map-pairs | |
"make a hash map from its arguments. each argument is a tuple (key value)" |
NewerOlder