Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Knudsen mknudsen

View GitHub Profile
@mknudsen
mknudsen / homebrew netpbm error
Created Oct 26, 2012
netpbm failed to build on 10.8.2
View homebrew netpbm error
======= Library/Logs/Homebrew/netpbm/02.make : =======
/private/tmp/netpbm-chao/netpbm-10.35.77/Makefile.common:551: Makefile.depend: No such file or directory
make: libpng-config: Command not found
cat /dev/null >Makefile.depend
make: libpng-config: Command not found
/usr/bin/make -C /private/tmp/netpbm-chao/netpbm-10.35.77/buildtools/ -f /private/tmp/netpbm-chao/netpbm-10.35.77/buildtools/Makefile \
SRCDIR=/private/tmp/netpbm-chao/netpbm-10.35.77 BUILDDIR=/private/tmp/netpbm-chao/netpbm-10.35.77 typegen
/private/tmp/netpbm-chao/netpbm-10.35.77/Makefile.common:551: Makefile.depend: No such file or directory
cat /dev/null >Makefile.depend
View gist:5d01aeb0a056cc47b43c
http://support.apple.com/kb/ht1573?viewlocale=de_DE
http://support.apple.com/kb/ht1379?viewlocale=de_DE
http://support.apple.com/kb/ht3964?viewlocale=de_DE
View tail-call-optimization-swift
func recursiveAdder(list:[Int]) -> Int {
switch list.count {
case 0:
return 0
case 1:
return list.first!
case 2:
@mknudsen
mknudsen / Currying.java
Created Jan 10, 2015
currying in java 8
View Currying.java
import java.util.function.BiFunction;
import java.util.function.Function;
public class Currying {
// A,B -> C
// A -> B -> C
public static BiFunction<Integer, Integer, Integer> add = (a, b) -> a + b;
View kotlin-koan.kt
fun main(args: Array<String>) {
// Starte mit "rats live on arona no evil star"
val sentence = "rats live on arona no evil star"
// 1. change all letters with their counterparts in the alphabet
val alphabetCounterparts: String = sentence.split(' ').map { word -> word.map { ch -> (122 - (ch.toInt() - 97)).toChar().toLowerCase() }.joinToString("") }.joinToString(" ")
// 2. convert all letters to their numeric value in the alphabet (a = 1)
val lettersToNumericValues:List<List<Int>> = alphabetCounterparts.split(' ').map { word -> word.map { ch -> ch.toInt() - 96 } }