Skip to content

Instantly share code, notes, and snippets.

View borismus's full-sized avatar

Boris Smus borismus

View GitHub Profile
@borismus
borismus / gist:1032746
Created June 18, 2011 02:46
Convert a base64 string into a binary Uint8 Array
var BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {
@borismus
borismus / gist:3939311
Created October 23, 2012 15:10
High DPI CSS image backgrounds with robust fallbacks
compass-image-set(W, H, IMG1, BP1, IMG2, BP2, ..., IMG_N, BP_N)
/** Default fallback */
sel {
background-image: url($IMG1);
background-size: $W, $H;
}
/* First pixel ratio breakpoint */
@borismus
borismus / index.html
Last active July 30, 2023 09:34
Asimov's Chronology of Science and Discovery rendered as a tech tree
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Tic-Tac-Toe Game Tree</title>
</head>
<body>
<script src="http://www.davidrobles.net/js/visualizing-game-trees-with-d3/underscore.js"></script>
<script src="http://www.davidrobles.net/js/visualizing-game-trees-with-d3/backbone.js"></script>
<script src="http://www.davidrobles.net/js/visualizing-game-trees-with-d3/d3.js"></script>
ID Date Discovery / Invention Individual Location (Empire) Notes Deps Type (Discovery/Invention/Social/Technique) Soft/hard? Field
biped 4000000 BCE Bipedal species emerged
stone-tool 2000000 BCE Stone tools used biped Invention
fire 500000 BCE Fire tamed Invention
religion 200000 BCE Religion Social Soft
art 20000 BCE Art Social Soft
bow 20000 BCE Bows and arrows used stone-tool Invention War
oil-lamp 20000 BCE Oil lamps invented stone-tool Invention
animal-dom 12000 BCE Animals domesticated Not horses. Maybe dogs and oxen? biped Technique Agriculture
agriculture 8000 BCE Agriculture developed animal-dom Technique Agriculture
@borismus
borismus / gist:2918946
Created June 12, 2012 17:38
Pinch-zoom recognizer
/**
* Gesture recognizer for compound multi-touch transformations.
*
* 1. pinch/zoom/scale gesture.
* 2. rotate gesture.
*/
function TransformRecognizer(element) {
// Reference positions for the start of the transformation.
this.referencePair = null;
function getBoundingBox(folded) {
const points = folded.vertices_coords.map(p => [p[0], p[1]]);
const boundary = ear.polygon(points);
return boundary.enclosingRectangle();
}
@borismus
borismus / readwise_to_markdown.py
Last active December 24, 2020 00:52
Download all Readwise highlights and save to them to plaintext markdown notes
#!/usr/bin/env python3
import datetime
import dateutil.parser
import json
import os
import requests
import sys
import time
import optparse
title participants
The Great Silence
2-6

By Allora & Calzadilla & Ted Chiang


The humans use Arecibo to look for extraterrestrial intelligence. Their desire to make a connection is so strong that they’ve created an ear capable of hearing across the universe.

Keybase proof

I hereby claim:

  • I am borismus on github.
  • I am borismus (https://keybase.io/borismus) on keybase.
  • I have a public key ASAav9FGD3taYPCU9tStO2p1tgmNHuZFuFjHz44Jz_BWhgo

To claim this, I am signing this object:

ID Date Discovery / Invention Individual Location (Empire) Notes Deps Type (Discovery/Invention/Social/Technique) Soft/hard? Field URL
biped 4000000 BCE Bipedal species emerged https://en.wikipedia.org/wiki/Bipedalism#Evolution_of_human_bipedalism
stone-tool 2000000 BCE Stone tools used biped Invention https://en.wikipedia.org/wiki/Stone_tool
fire 500000 BCE Fire tamed stone-tool Invention https://en.wikipedia.org/wiki/Control_of_fire_by_early_humans
religion 200000 BCE Religion fire Social Soft https://en.wikipedia.org/wiki/Prehistoric_religion
art 20000 BCE Art stone-tool Social Soft https://en.wikipedia.org/wiki/Prehistoric_art
bow 20000 BCE Bows and arrows used stone-tool Invention War https://en.wikipedia.org/wiki/History_of_archery#Prehistory
oil-lamp 20000 BCE Oil lamps invented stone-tool Invention https://en.wikipedia.org/wiki/Oil_lamp
animal-dom 12000 BCE Animals domesticated Not horses. Maybe dogs and oxen? biped Technique Agriculture https://en.wikipedia.org/wi