This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JSON | |
function create_data(n::Int) | |
r = fill([], n, n) | |
for i in eachindex(r) | |
r[i] = rand(1000:5000, rand(0:3)) | |
end | |
return r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('lodash') | |
const Graph = require('node-dijkstra') | |
/* | |
problem: | |
we want to paint a series of buildings | |
each building can be one of 3 colors (red, green, blue) | |
each building has its own cost per color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Facebook Remove Like | |
// @namespace http://edisdead.com | |
// @author quatrix | |
// @description removes like buttons and indicators from facebook, sick. | |
// @version 0.1 | |
// @run-at document-start | |
// @include htt*://*.facebook.com/* | |
// @exclude htt*://apps.facebook.com/* | |
// @exclude htt*://www.facebook.com/checkpoint/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ShiftRegister74HC595.h> | |
#define LATCH_PIN 3 | |
#define CLOCK_PIN 4 | |
#define DATA_PIN 2 | |
#define OE_PIN 5 | |
#define RESET_PIN 6 | |
#define NUMBER_OF_SHIFTERS 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def flatten(n): | |
if isinstance(n, bool): | |
return | |
while True: | |
changed = False | |
for k, v in n.iteritems(): | |
if isinstance(v, bool): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def flatten(n): | |
while True: | |
changed = False | |
for k, v in n.iteritems(): | |
if len(v.keys()) == 1: | |
del n[k] | |
vk = v.keys()[0] | |
n[k + '/' + vk] = v[vk] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// basically just reimplemented (paritally) the TimeSpanSemaphore | |
// as specified here http://joelfillmore.com/throttling-web-api-calls/ | |
import ( | |
"container/heap" | |
"fmt" | |
"sync" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var forms = require('newforms'); | |
var _ = require('underscore'); | |
var RegexValidator = forms.validators.RegexValidator | |
var $ = require('jquery'); | |
var schema = { | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"id": "/", | |
"type": "object", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'quatrix' | |
import re | |
import unittest | |
def _get_lowest_version(s): | |
""" | |
Takes a string of the following format: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
def my_product(head, *tail): | |
if not tail: | |
return ((h,) for h in head) | |
return ((h,) + t for h in head for t in my_product(*tail)) | |