Skip to content

Instantly share code, notes, and snippets.

View stianeikeland's full-sized avatar

Stian Eikeland stianeikeland

View GitHub Profile
@stianeikeland
stianeikeland / redirect-news.user.js
Created February 28, 2013 11:30
Avoid the stupid celebrity news at vg.no / db.no
// ==UserScript==
// @name          redirect
// @description    redirect
// @include        http://www.vg.no/
// @include http://www.dagbladet.no/
// @version        1.0
// ==/UserScript==
if (window.location == 'http://www.vg.no/')
window.location = 'http://www.vg.no/nyheter/'

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@stianeikeland
stianeikeland / fromRoman.coffee
Created April 4, 2013 10:16
Bergen coding dojo - Roman numerals
_ = require 'underscore'
class FromRomanNumerals
baseValues: {
"I": 1
"V": 5
"X": 10
"L": 50
@stianeikeland
stianeikeland / test.md
Last active December 19, 2015 00:09
Tasklist
  • this is a complete item
  • this is an incomplete item
import png
import random
imgsize = 900
img = [[random.randint(0, 255) for x in range(imgsize)] for y in range(imgsize)]
f = open('rnd.png', 'wb')
w = png.Writer(imgsize, imgsize, greyscale=True)
w.write(f, img)
// A concurrent prime sieve
package main
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func Generate(ch chan<- int) {
for i := 2; ; i++ {
ch <- i // Send 'i' to channel 'ch'.
}
}
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"strconv"
"strings"
)
func GetFloridaFloat(datarows *goquery.Selection, field int) (data float64, err error) {
package main
import (
"fmt"
"os"
"reflect"
"syscall"
"unsafe"
)
@stianeikeland
stianeikeland / gamesim.coffee
Created September 11, 2013 20:58
Tennis kata
{Game, Player, Advantage} = require "./main"
playGame = (gamedata) ->
game = new Game
for x in gamedata.split " "
game.setAdvantage Advantage.playerA if x is "advA"
game.setAdvantage Advantage.playerB if x is "advB"
game.pointA() if x is "pointA"
game.pointB() if x is "pointB"
Gox = require 'goxstream'
JSONStream = require 'json-stream'
Boxcar = require 'boxcar'
osxnotify = require 'osx-notifier'
log = require 'npmlog'
argv = (require 'optimist')
.usage('Usage: $0')
.alias('h', 'high')