Skip to content

Instantly share code, notes, and snippets.

View pepe's full-sized avatar

Josef Pospíšil pepe

View GitHub Profile
(defn http-get
"Get some HTTP using curl"
[url]
(with [f (file/popen (string "curl -s " url))]
(:read f :all)))
(http-get "https://www.google.com")
static JanetFunction *global_cb = NULL;
Janet register_callback(int32_t argc, Janet *argv) {
janet_fixarity(argc, 1);
JanetFunction *cb = janet_getfunciton(argv, 0);
global_cb = cb;
// Make sure the callback is not garbage collected while waiting
janet_gcroot(argv[0]);
return janet_wrap_nil();
}
@thheller
thheller / benchmark.cljs
Last active August 6, 2019 20:00
dummy node benchmark for creating react elements in cljs
(ns shadow.grove.react.benchmark
(:require
["benchmark" :as b]
["react" :as react :rename {createElement rce}]
["react-dom/server" :as rdom]
[hx.react :as hx]
[shadow.grove.react :as shadow]
[reagent.core :as reagent]
[rum.core :as rum]
[fulcro.client.dom :as fulcro-dom]))
@s5bug
s5bug / fizzbuzz.sc
Last active June 7, 2020 19:59
Scala "Enterprize" Fizzbuzz
import eu.timepit.refined._
import eu.timepit.refined.api.Refined
import eu.timepit.refined.numeric._
import fs2._
def defaultMap[T](implicit numeric: Numeric[T]): Map[T Refined Positive, String] =
Map(
refineV[Positive](numeric.fromInt(3)).right.get -> "fizz",
refineV[Positive](numeric.fromInt(5)).right.get -> "buzz"
)
@xificurC
xificurC / clojure-specter-benchmarks
Last active December 18, 2018 13:16
Clojure specter benchmarks done with criterium benchmarking library
Leiningen 2.8.1 on Java 1.8.0_181 OpenJDK 64-Bit Server VM
{:dependencies
([org.clojure/clojure "1.9.0"] [criterium/criterium "0.4.4"]),
:jvm-opts nil,
:eval-in nil}
Benchmark: get value in nested map
Mean(us) vs best Code
@pepasflo
pepasflo / .gitignore
Last active October 22, 2023 12:06
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@burn2delete
burn2delete / spec.cljs
Last active June 7, 2017 10:20
Use data to validate data.
;; Basic Specs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(spec/def ::fn fn?)
(spec/def ::any any?)
(spec/def ::map map?)
(spec/def ::nil nil?)
(spec/def ::set set?)
@elithrade
elithrade / vimfiler-shortcuts
Last active October 12, 2022 21:13
Common vimfiler keyboard shortcuts
Toggle safe mode: gs
Create new file: N
Delete file: d
Rename file: r
New directory: K
Open file: e
Move file: m
Open VimFilerExplorer: e
Open current directory in a new buffer: dl
Open current directory in a new split: ds
@yogthos
yogthos / gallery.cljs
Last active March 30, 2024 17:36
script to download walpapers from windowsonearth.org
@yogthos
yogthos / RichHickeyInterview.md
Created April 25, 2017 00:38
An in-depth look at the new language with Rich Hickey, Creator of Clojure

from http://www.linuxjournal.com/article/10708

An in-depth look at the new language with Rich Hickey, Creator of Clojure

DE: What did you do before you started the Clojure project?

RH: I'm a consultant, so I work on various things. I think the big thing I've done recently is I worked on the national exit poll.

DE: What other languages did you use before inventing your own?