Skip to content

Instantly share code, notes, and snippets.

View jpettersson's full-sized avatar

Jonathan Pettersson jpettersson

  • Voi
  • Stockholm
View GitHub Profile
#include <Lighthouse.h>;
Lighthouse lighthouse = Lighthouse('5', '4');
int fanPin = 6;
int coolPin = 7;
char STATE_OFF = '1';
char STATE_FAN = '2';
char STATE_COOL = '3';
@jpettersson
jpettersson / Vagrantfile
Created March 4, 2013 19:51
Vanilla Vagrant (For opscode testing)
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :bridged, :bridge => "en0: Ethernet"
end
require 'airport_events'
# Create a new Watcher instance and set up some event listeners.
watcher = AirportEvents::Watcher.new
watcher.on :connected do |ssid, date|
puts "Connected to #{ssid} on #{date}"
end
watcher.on :disconnected do |date|
angular.module('jpettersson.reflect')
.config(function ($urlRouterProvider, $stateProvider) {
// For unmatched routes
$urlRouterProvider.otherwise('/dashboard');
// Application routes
$stateProvider
.state('login', {
@jpettersson
jpettersson / gist:4a719e12a03cdfc91ef1
Created December 12, 2014 09:44
Git: Apply changes from branch as unstaged changes on other branch
Sometimes that "quick" refactor takes longer than I was planning for. Then it's nice to commit changes to a temporary "dirty" feature branch just to have an off-laptop backup and change history. I use this method for storing a bunch of trash commits on a feature branch and then lifting them back over to master when I want to continue work / clean up.
# Check out the branch you want to start working from
git checkout master
# Check out the dirty "refactor" branch as staged changes
git checkout refactor -- .
# Reset will unstage the changes
git reset

Keybase proof

I hereby claim:

  • I am jpettersson on github.
  • I am jpettersson (https://keybase.io/jpettersson) on keybase.
  • I have a public key ASDaqNa_wS4zflVgBl9H_ktn-wlaq9iMy40t2LZtBdeqcQo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am jpettersson on github.
* I am jpettersson (https://keybase.io/jpettersson) on keybase.
* I have a public key ASDrNfWAfRseT_Hly-jDnyEiiMKuN92rHYSlN94iv8qefgo
To claim this, I am signing this object: