Skip to content

Instantly share code, notes, and snippets.

@gythialy
gythialy / gson.java
Last active July 11, 2021 07:30
Gson support Guava MutiMap and Table
package com.wescon.cv.utilities;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.nutz.castor.Castors;
@mbostock
mbostock / .block
Last active March 6, 2019 05:06 — forked from mbostock/.block
Contour Plot
license: gpl-3.0
height: 673
border: no
redirect: https://observablehq.com/@d3/volcano-contours
@jboner
jboner / latency.txt
Last active May 30, 2024 06:31
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mathiasverraes
mathiasverraes / .bashrc
Created November 3, 2011 18:46 — forked from thomasvm/.bashrc
Git shortcuts
#! /bin/sh
alias gs="git status"
alias gc="git commit"
alias gr="git checkout"
alias ga="git add"
alias gl="git lola"
@kylelemons
kylelemons / enum.go
Created October 23, 2011 17:26
Enumerations in Go with string names
package main
import "fmt"
type day int
const (
Sunday day = iota
Monday
Tuesday
Wednesday
@kylelemons
kylelemons / enum.go
Created September 8, 2011 18:49
Enum types (bitshifted too)
package main
import (
"fmt"
"strings"
)
type foo int
const (
One foo = iota
@jlbruno
jlbruno / isItScrollableWithoutVisibleScrollbars.js
Created July 22, 2011 18:54
a function to check if a certain element is scrollable, but is NOT showing scrollbars. Useful to use as a test for when you might want to implement another scrolling solution, such as iScroll for iPad.
var isItScrollableWithoutVisibleScrollbars = function(el) {
if (el === null) {
return false;
}
var isScrollable = false;
var hasScrollbars = false;
// first, lets find out if it has scrollable content
isScrollable = el.scrollHeight > el.offsetHeight ? true : false;
// if it's scrollable, let's see if it likely has scrollbars
if (isScrollable) {