Skip to content

Instantly share code, notes, and snippets.

@zg
zg / freebsd-qemu-xhyve-mac-os-x-virtual-machine.md
Last active March 22, 2025 20:32
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.

TL;DR

  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.

Requisites

@JacobNinja
JacobNinja / gist:f463717d99aadc0d903ebdb6c67c7f3b
Created May 11, 2016 15:48
Loop/recur compiled example
cljs.user=> (defn foo [] (loop [i 1] (if (>i 10) i (recur (inc i)))))
#'cljs.user/foo
cljs.user=> foo
#object[cljs$user$foo "function cljs$user$foo(){
var i = 1;
while(true){
if(cljs.core.truth_(cljs.user._GT_i.call(null,10))){
return i;
} else {
var G__23 = (i + 1);
anonymous
anonymous / index.html
Created March 28, 2016 16:59
MotorcycleJS checkbox example // source http://jsbin.com/vefotux
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="checkbox example">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://wzrd.in/standalone/most"></script>
<script src="https://wzrd.in/standalone/@motorcycle%2Fcore"></script>
<script src="https://gist.githubusercontent.com/Risto-Stevcev/2f407cbcc1ce33074237/raw/9ed5867704a5f4be53e34e450709706820d342cf/dom.js"></script>
<title>MotorcycleJS</title>
anonymous
anonymous / index.html
Created March 28, 2016 16:09
MotorcycleJS http example // source http://jsbin.com/vefotux
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="http example">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://wzrd.in/standalone/most"></script>
<script src="https://wzrd.in/standalone/@motorcycle%2Fcore"></script>
<script src="https://gist.githubusercontent.com/Risto-Stevcev/2f407cbcc1ce33074237/raw/9ed5867704a5f4be53e34e450709706820d342cf/dom.js"></script>
<script src="https://gist.githubusercontent.com/Risto-Stevcev/62881c9b9a60931f1bc9/raw/54f6e2ae704f8a08d1d1a80b665c154263a500cb/http.js"></script>
@DrBoolean
DrBoolean / coyo_uses.js
Created February 26, 2016 15:40
Coyoneda Uses in JS
const daggy = require('daggy')
const compose = (f, g) => x => f(g(x))
const id = x => x
//===============Define Coyoneda=========
const Coyoneda = daggy.tagged('x', 'f')
Coyoneda.prototype.map = function(f) {
return Coyoneda(this.x, compose(f, this.f))
}
@Avaq
Avaq / combinators.js
Last active May 20, 2025 01:53
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))
@rodrigogribeiro
rodrigogribeiro / Test.agda
Last active July 4, 2017 14:36
Proof about Kleene star idempotence in Agda.
open import Data.List as List
open import Data.List.Properties
open List-solver renaming (nil to :[] ; _⊕_ to _:++_; _⊜_ to _:==_)
open import Data.Product renaming (_×_ to _*_)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality renaming (_≡_ to _==_)
open import Relation.Nullary renaming (¬_ to not)
module Test {Token : Set}(eqTokenDec : Decidable {A = Token} _==_) where
@Avaq
Avaq / dates.js
Last active December 20, 2017 13:04
new Date('12 dec, 20111') //-> +020111-12-11T23:00:00.000Z
new Date(-1, 1) //-> -000001-01-31T23:00:00.000Z
new Date(-1, -1) //-> -000002-11-30T23:00:00.000Z
new Date(-10, 1) //-> -000010-01-31T23:00:00.000Z
new Date('12 dec, 000201') //-> 0201-12-11T23:00:00.000Z
new Date('12 dec, 201') //-> 0201-12-11T23:00:00.000Z
new Date('1212 dec') //-> 1212-11-30T23:00:00.000Z
new Date('1212 2 dec 2') //-> 1212-12-01T23:00:00.000Z
new Date('1212 2 dec 4') //-> 1212-12-01T23:00:00.000Z
new Date('1212 2 dec') //-> 1212-12-01T23:00:00.000Z
@paulirish
paulirish / what-forces-layout.md
Last active July 21, 2025 17:36
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@haasn
haasn / about:config.md
Last active December 27, 2024 15:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.