Skip to content

Instantly share code, notes, and snippets.

View johannilsson's full-sized avatar

Johan Berg johannilsson

View GitHub Profile
<?php
class Domain_Model_User {
private $id;
private $name;
}
interface Domain_Model_UserRepository {
public function save(Domain_Model_User $user);
public function find($id); // Returns Domain_Model_User
}
class UserService {
@johannilsson
johannilsson / spotify-raspberry.md
Created December 7, 2013 13:19
Notes for getting Spotify to run o a Raspberry Pi.

Spotify on Raspberry Pi

Notes for getting libspotify to run on a RPi.

sudo apt-get install libasound2-dev
sudo apt-get install alsa-utils

Not completly sure if this was needed but found it in my history. But should allow playback using the rca cable.

amixer cset numid=3 1

@johannilsson
johannilsson / build.sh
Last active December 27, 2015 22:29
Templating with Browserify, domify & brfs.
browserify index.js -o bundle.js -t brfs
@johannilsson
johannilsson / resize.sh
Created October 18, 2013 07:23
Helper that resize all png images in the given directory.
ROOT=$1
OUT=$ROOT/out
rm -rf $OUT
mkdir -p $OUT
for i in `ls $ROOT | grep .png`; do
#convert $ROOT/$i -resize 40% $OUT/$i
convert $ROOT/$i -resize 185x185 $OUT/$i
done
@johannilsson
johannilsson / make-sprite.sh
Created October 18, 2013 07:26
Make a sprite & a debug sprite of a set of png image.
#!/bin/sh
echo Creating output.
rm -rfv out
mkdir -vp out
echo Making tiled version.
montage *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out.png
echo Making tiled debug version
montage -label '%t\n%[width]x%[height]' -font 'Arial' *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out-debug.png
echo Running optipng
optipng out/out.png -out out/out-opt.png
@johannilsson
johannilsson / sthlmtraveling.user.js
Last active December 20, 2015 19:29
STHLM Traveling + IITC
// ==UserScript==
// @id iitc-plugin-sthlmtraveling@johannilsson
// @name IITC plugin: STHLM Traveling.
// @category Portal Info
// @version 0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description [johannilsson-2013-08-08-1546] Adds a link to the portal details to open and plan a trip to the portal using the app STHLM Traveling.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@johannilsson
johannilsson / tosprite.sh
Created March 1, 2013 16:45
Quick and dirty tile sprite image from a set of pngs.
#!/bin/sh
echo Creating output.
rm -rfv out
mkdir -vp out
echo Making tiled version.
montage *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out.png
echo Making tiled debug version
montage -label '%t\n%[width]x%[height]' -font 'Arial' *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out-debug.png
echo Running optipng
optipng out/out.png -out out/out-opt.png
for i in `find /opt/graphite/storage/whisper/servers -name *.wsp`; do whisper-resize.py $i 60:90d $i; done;
@johannilsson
johannilsson / webrtcgetusermediademo.html
Created April 1, 2012 14:28
WebRTC getUserMedia Demo
<!doctype html>
<!--
To run this demo you need to have seriously and the nightvision effect.
wget https://raw.github.com/brianchirls/Seriously.js/master/seriously.js
mkdir effects
cd effects
wget https://raw.github.com/brianchirls/Seriously.js/aacdc75665d98a52c8a0c2e0e0cbbf85b136a151/effects/seriously.nightvision.js
-->
<html>
int leds[] = {12, 8};
int potPin = 2;
void setup() {
Serial.begin(9600);
for (int i; i <= sizeof(leds); i++) {
pinMode(leds[i], OUTPUT);
}