Skip to content

Instantly share code, notes, and snippets.

@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@mattdesl
mattdesl / gist:10218005
Created April 9, 2014 01:45
pseudo-code for perlin-noise based generative impressionist paintings
render
for each particle
x, y = particle.position
color = sample( colorMap, x, y )
noise = sample( noiseMap, x, y )
angle = noise * PI * 2
particle.velocity.add( cos(angle), sin(angle) )
@pabigot
pabigot / rotate.cc
Created November 19, 2013 18:52
C++11 template function to perform integer rotations without invoking undefined behavior. See http://blog.regehr.org/archives/1063
/* See http://blog.regehr.org/archives/1063
*/
#include <type_traits>
#include <cstdint>
#include <limits>
#include <typeinfo>
#ifndef ARGTYPE
#define ARGTYPE uint32_t
#endif /* ARGTYPE */
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@arnehormann
arnehormann / must.go
Created September 23, 2013 10:58
usage example for reflect.MakeFunc: create panic-on-error wrappers which do not pass the error (in a comfortable but probably rather slow way)
import "reflect"
// assumption for fptr: func with error as last argument
func makeMust(fptr interface{}) {
must := func(in []reflect.Value) []reflect.Value {
if err := in[len(in)-1]; !err.IsNil() {
panic(err.Interface())
}
return in[:len(in)-1]
}
@cuadue
cuadue / cubism-websockets.html
Created September 3, 2013 17:43
Streaming data to cubism.js with websockets
<!DOCTYPE html>
<meta charset='utf-8'>
<head>
<title>Cubism + Websockets</title>
<script language='javascript' src='d3.min.js'></script>
<script language='javascript' src='cubism.v1.js'></script>
<script language='javascript'>
/* I can never seem to remember:
Array.push() appends to the end, and returns the new length
#!/bin/bash
# stop on errors and undeclared variables
set -e -u -o pipefail
err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2
}
@minikomi
minikomi / persona.go
Last active December 11, 2015 06:59
mozilla persona test
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/sessions"
"io/ioutil"
"log"
"net/http"
"net/url"
@malarkey
malarkey / Three Wise Monkeys.md
Created December 2, 2012 14:26
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?