Skip to content

Instantly share code, notes, and snippets.

View martinlindhe's full-sized avatar
😸

Martin Lindhe martinlindhe

😸
View GitHub Profile
/*! angular-google-maps 1.1.6 2014-06-28
* AngularJS directives for Google Maps
* git: https://github.com/nlaplante/angular-google-maps.git
*/
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
@martinlindhe
martinlindhe / min.php
Last active November 19, 2015 12:10
99 bottles
# 208 bytes
$b=99;$d=" bottles of beer";$c="$d on the wall";do{echo "$b$c, $b$d.\n";if(!--$b){echo "Go to the store and buy some more";$b=99;}else echo "Take one down and pass it around";echo ", $b$c.\n\n";}while($b<99);
@martinlindhe
martinlindhe / day1.go
Created December 1, 2015 13:02
advent of code - day 1
package aoc
func CalcFloor(s string) int {
res := 0
for i := 0; i < len(s); i++ {
if s[i] == '(' {
res++
} else if s[i] == ')' {
res--
@martinlindhe
martinlindhe / Interpreter.php
Last active December 1, 2015 16:18
brainfuck php
<?php namespace MartinLindhe\Brainfuck;
class Interpreter
{
protected $cells;
protected $pointer = 0;
public function exec($s)
{
@martinlindhe
martinlindhe / aoc1-1.asm
Created December 3, 2015 09:58
advent of code 1.1 in BSD (osx) assembly
section .text
global mystart
int_to_string:
add esi,9
mov byte [esi],0
mov ebx,10
.next:
@martinlindhe
martinlindhe / day6.go
Created December 7, 2015 10:42
aoc 6 in go
package aoc
import (
"fmt"
"regexp"
"strconv"
)
func newChristmasLightsPart2() [1000][1000]int {
// 1 million lights in a 1000x1000 grid
@martinlindhe
martinlindhe / day7.go
Last active December 8, 2015 11:34
aoc day 7.1
package aoc
import (
"fmt"
"regexp"
"strconv"
"strings"
)
func makeCircuit(s string) map[string]string {
package main
import (
"bufio"
"fmt"
"image"
"image/draw"
"image/png"
"io/ioutil"
"log"
#!/bin/sh
#
# NOTE: this only works on OSX due to the syntax of the stat command
#
# brew install jpeg jpegoptim
inFile=$1
if [ -z $inFile ]; then
echo "Syntax: $0 filename"
#!/bin/sh
#
# NOTE: this only works on OSX due to the syntax of the stat command
#
# brew install pngcrush optipng
inFile=$1
if [ -z $inFile ]; then
echo "Syntax: $0 filename"