Skip to content

Instantly share code, notes, and snippets.

View wiredearp's full-sized avatar

Wired Earp wiredearp

  • Wunderbyte
  • Denmark
View GitHub Profile
anonymous
anonymous / http.cljs
Created November 10, 2016 10:03
Clojurescript node sample
(ns helloserver
(:require [cljs.nodejs :as nodejs]))
(def http (nodejs/require "http"))
(-> (.createServer http (fn [req res]
(doto res
(.writeHead 200 {"Content-Type" "text/plain"})
(.end "Hello from ClojureScript"))))
(.listen 8080 "127.0.0.1"))
@nikopol
nikopol / dom-core.cljs
Last active September 15, 2019 01:31
minimalist dom manipulation clojure script library
(ns dom.core
(:require [clojure.string :as str]
[clojure.set :refer [difference union]]))
; sample usage:
; (-> (all ".class") (hide) (+css "titi") (clear) (html "<span>zob</span>") (show))
(defn- nodelist-coll [nodelist]
(doall (map #(.item nodelist %) (range (.-length nodelist)))))
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active May 21, 2026 11:58
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

Parens And Performance

Years ago, some smart folks that worked on JS engines realized that not all JS that's loaded into a page/app initially is needed right away. They implemented JIT to optimize this situation.

JIT means Just-In-Time, which means essentially that the engine can defer processing (parsing, compiling) certain parts of a JS program until a later time, for example when the function in question is actually needed. This deferral means the engine is freer to spend the important cycles right now on the code that's going to run right now. This is a really good thing for JS performance.

Some time later, some JS engine devs realized that they needed to get some hints from the code as to which functions would run right away, and which ones wouldn't. In technical speak, these hints are called heuristics.

So they realized that one very common pattern for knowing that a function was going to run right away is if the first character before the function keyword was a (, because that usually m

@ebidel
ebidel / fancy-tabs-demo.html
Last active November 18, 2025 13:32
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<style>
body {
margin: 0;
}
/* Style the element from the outside */
/*
fancy-tabs {
margin-bottom: 32px;
@rauchg
rauchg / README.md
Last active May 16, 2026 01:17
require-from-twitter

Turning Off Github Issues

My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...

Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they

@Avaq
Avaq / combinators.js
Last active August 31, 2026 20:27
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@manigandham
manigandham / rich-text-html-editors.md
Last active November 30, 2025 19:04
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors