Skip to content

Instantly share code, notes, and snippets.

@dvdveer
dvdveer / create_lfs_bundle.sh
Created April 29, 2020 16:38
Shell script to create a git bundle including changed LFS files
#!/bin/sh
# This script creates a bundle of git commits between START and END.
# It also tars the lfs files that changed in those commits.
# When you unbundle on the receiving side you should untar the LFS tar *before*
# running 'git pull' on the bundle file.
# Note that this is just an example script that doesn't do error checking, and
# also doesn't account for submodules, etc. YMMV
# Start and end commits of bundle
@alphaKAI
alphaKAI / cpuid.d
Created August 14, 2019 19:38
manipulate CPUID instruction
import std.stdio;
import std.conv;
import std.string;
struct Regs {
uint a, b, c, d;
}
Regs cpuid(uint eax) {
Regs r;
@eddiewebb
eddiewebb / readme.md
Last active February 12, 2024 08:46
Hugo JS Searching with Fuse.js

float32
float64
int
int8
int16
int32
int64
@leque
leque / freer-monad.scm
Last active May 11, 2016 01:35
Freer monad in Scheme
;;;; Freer monad in Scheme
;;;; See also
;;;; * "Freer monads, more extensible effects"
;;;; http://dl.acm.org/citation.cfm?doid=2804302.2804319
;;;; * Free monad in Scheme https://gist.github.com/wasabiz/951b2f0b22643a59aeb2
(use gauche.record)
(use util.match)
;;; data Freer f a where
;;; Pure :: a -> Freer f a
@nyuichi
nyuichi / monad.scm
Created September 10, 2015 19:46
自由モナドを使えば動的型付けでも多相的なモナド演算ができますよというお話
(import (gauche partcont)
(scheme base)
(scheme write))
;;; generic fmap
(define *fmap-methods*
`((,list? . ,map)))
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active February 22, 2024 03:40
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.