Skip to content

Instantly share code, notes, and snippets.

View timoschilling's full-sized avatar
👻
yolo

Timo Schilling timoschilling

👻
yolo
View GitHub Profile
package main
import (
"strconv"
"github.com/brutella/hc"
"github.com/brutella/hc/log"
"github.com/brutella/hc/accessory"
)
type Bridge struct {
@timoschilling
timoschilling / fizzbuzz.html
Created November 24, 2015 11:52 — forked from moonglum/fizzbuzz.html
This is a FizzBuzz Solution I found on Twitter. It was always shared as a screenshot, so I typed it myself, to try it out ;) Source: https://twitter.com/ericwastl/status/667567483432402944
<html>
<head>
<style>
body {
counter-reset: n;
}
div:before {
counter-increment: n;
content: counter(n);
}
@timoschilling
timoschilling / operation.rb
Last active November 7, 2015 19:02 — forked from stoffie/operation.rb
can be deleted on next cleanup
class Create < Trailblazer::Operation
include Model
model Workflow
contract do
property :name
property :description
collection :steps, populate_if_empty: Step do
property :form, populate_if_empty: lambda { |params, *| Form.find(params[:workflow][:steps][:form][:id]) }
#!/bin/sh
#
# Lives in .git/hooks.
# To enable this hook, rename this file to "pre-commit".
# Redirect output to stderr.
exec 1>&2
# works, but is slow. try with ack!
# LANG=C find . -name '*_spec.rb' | xargs egrep -q '^\s*(describe|it|context)\b.*focus'
@timoschilling
timoschilling / nrt2tokyo.rb
Created June 20, 2012 09:35 — forked from melborne/nrt2tokyo.rb
Solve optimal path from Narita to Tokyo with inject
class OptimalPath
def initialize(road_system)
@road_system = road_system
end
def solve
bestA, bestB =
@road_system.inject([Path.new, Path.new]) do |(pathA, pathB), section|
road_step(pathA, pathB, section)
end