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
(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)) |
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
merge: merge.c | |
$(CC) -std=c89 -Wall $^ -o $@ | |
clean: | |
-rm merge |
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
:- 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)) --> |
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 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; |
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 <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)) */ |
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 java.util.List; | |
import java.util.Arrays; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Formatter; | |
public class Machine { | |
private Tape<Integer>[] tapes; | |
private int[] memory; | |
private final int scratch; // index of the scratch tape |
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 Data.List | |
type Weight = Int | |
type Value = Int | |
type Item = (String,Weight,Value) | |
type Pack = ([String],Weight,Value) | |
knapsack :: (Pack -> Bool) -> [Item] -> [Pack] | |
knapsack f = sortBy (value) . filter (f) . map (foldl (pack) ([],0,0)) . tail . subsequences | |
where value (_,_,v1) (_,_,v2) = compare v2 v1 |
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
#!/usr/bin/env perl | |
use v5.14; | |
use warnings; | |
use Time::Format qw(time_format); | |
use Time::ParseDate; | |
die <<END if $ARGV[0] && $ARGV[0] =~ m/-h(?:elp)?/; | |
$0: Fuzzy time conversion to localtime |
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
// Raw SVG: http://evemaps.dotlan.net/svg/Branch.dark.svg | |
function system(name,fn) { | |
document.getElementsByClassName('ss').each(function(elem){ | |
if(elem.textContent == name) fn.call(elem.parentElement) | |
}); | |
} | |
system('D4R-H7',function(){this.getElementsByClassName('s')[0].style.fill = '#000000'}); |
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 Data.List | |
import Data.Maybe | |
input x = map (\(a,b) -> (a, b * x)) | |
reduce :: [([Char], Integer)] -> [([Char], Integer)] | |
reduce = map (\(a,b) -> (head a, sum b)) . map (unzip) . group . sort | |
planet n = map (\(a,_) -> (n,a)) | |
planets_for = foldl1 | |
(\a b -> |
OlderNewer