Skip to content

Instantly share code, notes, and snippets.

@yulvil
yulvil / wikitree_children_snippet.js
Last active October 16, 2016 04:44
Snippet to put Children on separate rows (wikitree.com)
javascript:(function(){
var num = 1;
var els = document.getElementsByTagName('span');
for(var i=0; i<els.length; i++) {
var prop = els[i].getAttribute('itemprop');
if(prop === "children") {
var numElem = document.createTextNode("" + num + ". ");
els[i].insertBefore(numElem, els[i].firstChild);
var br = document.createElement("br");
@yulvil
yulvil / censusofcanada.js
Last active August 10, 2018 18:22
Bookmarklet Census of Canada Reference
javascript:(function(){
var re_year = /\/(\d{4})\//;
var yyyy = re_year.exec(document.location) || {};
var re_lang = /\/(eng|fra)\//;
var lang = re_lang.exec(document.location) || {};
if (lang[1] === "fra") {
document.location = document.location.replace("fra/recensements", "eng/census");
}
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
@yulvil
yulvil / data.csv
Created August 7, 2016 20:56
d3js test
name value
Locke 4
Reyes 8
Ford 15
Jarrah 16
Shephard 23
Kwon 42
@yulvil
yulvil / gist:8e4329102bbdf3eb53ae
Created March 2, 2016 20:09
golang http context
// Context example
// From https://github.com/garyburd/go-oauth/blob/master/examples/appengine/app.go
package main
import (
"fmt"
"log"
"net/http"
)
package main
import (
"encoding/binary"
"io"
"log"
"os"
)
func write8(w io.Writer, b byte) error {
@yulvil
yulvil / gist:01762153d15ac7e07ef2
Created January 23, 2016 04:40
gopherjs sample page
<!doctype html>
<html>
<head>
<script src="calculate.js"> </script>
<script>
function convert(form) {
var v = document.getElementById("zinput").value;
var algo = document.getElementById("zalgo").value;
document.getElementById("zoutput").value = eval(algo)(v);
}
@yulvil
yulvil / cgo.go
Created January 12, 2016 01:04
golang cgo example
==> main.go <==
package main
/*
#cgo LDFLAGS: -L${SRCDIR} mylib.a -lm
#include <math.h>
#include "mylib.h"
int mysub(int n, int m) { return n-m; }
*/
import "C"
@yulvil
yulvil / tmuxStart.sh
Last active January 8, 2016 03:42
tmux startup script - launch multiple windows
#!/bin/bash
# var for session name (to avoid repeated occurences)
sn=$RANDOM
# Start the session and window 0 in $HOME
# This will also be the default cwd for new windows created
cd $HOME
tmux new-session -s "$sn" -n $HOME -d
@yulvil
yulvil / golang-sort.go
Created August 25, 2015 00:38
golang sort
package main
import "fmt"
import "sort"
type Organ struct {
Name string
Weight Grams
}