Skip to content

Instantly share code, notes, and snippets.

@tron1point0
tron1point0 / merge.c
Created May 8, 2014 20:06
Merge n arrays
#include <stdlib.h>
#include <stdio.h>
void swap(int32_t **a, int32_t **b) {
int32_t *tmp = *a;
*a = *b;
*b = tmp;
}
/* In-place update of subtree at `i` - O(log(n)) */
import java.util.Date;
public class Count {
static int[] _counts = {
0,1,1,2,
1,2,2,3,
1,2,2,3,
2,3,3,1
};
static int[] counts;
@tron1point0
tron1point0 / parse.pl
Created May 8, 2014 20:11
Java tokenizer/lexer/parser
:- module(parse,[parse/3]).
:- use_module(library(utils)).
parse(Es) --> complation_units(Es).
compilation_units([E|Es]) --> compilation_unit(E), compilation_units(Es).
compilation_units([],A,A).
compilation_unit(unit(Unit)) -->
@tron1point0
tron1point0 / Makefile
Created February 26, 2014 23:47
Merge multiple arrays.
merge: merge.c
$(CC) -std=c89 -Wall $^ -o $@
clean:
-rm merge
(function() {
var color_stuff = function(selector,classes) {
var nth_of_type = function(len,i) {
return ':nth-of-type(' + len + 'n+' + i + ')'
};
var nested = function(c) {
return function() {
var cs = classes.filter(function(e) { return e !== c });
for (var i = 0; i < cs.length; i++)
$(this).children(selector + nth_of_type(cs.length,i))