Skip to content

Instantly share code, notes, and snippets.


Sven Pfleiderer pfleidi

View GitHub Profile
View bedtime.yaml
- data:
brightness_pct: 100
kelvin: 2400
entity_id: light.svens_bedroom
service: light.turn_on
- data: {}
entity_id: switch.living_room_tv
service: switch.turn_off
View closet_light.yaml
- id: '1600125859583'
alias: Sven's Closet Light
description: ''
- entity_id: binary_sensor.door_sven_closet
from: 'off'
platform: state
to: 'on'
condition: []
View night_light.yaml
- id: '1601056415222'
alias: Living Room Night Light
description: ''
- platform: state
entity_id: binary_sensor.motion_living_room
from: 'off'
to: 'on'
- condition: numeric_state

The pull request empoji code

  • 👍 This is great!
  • I have a question / can you clarify?
  • This has to change. It’s possibly an error or strongly violates existing conventions.
  • 🔧 This is a well meant suggestion. Take it or leave it.
  • 🙃 This is a nitpick.
  • 🤔 I have some serious concerns about this particular piece of code, we should think about it/discuss it further.
  • 🤡 This is a complaint about something we don’t have an obvious answer to and that is not necessarily a problem originating from your changes.
View string_concat.rb
require 'stringio'
require 'benchmark/ips'
list = 1...10_000
Benchmark.ips do |x|
x.config(:time => 10, :warmup => 2)'String#<<') do
s = ''
pfleidi / pre-push
Last active Aug 29, 2015
Automatically make an animated GIF of yourself and upload it to a specified slack channel.
View pre-push
FILE_PATH="$(ls ~/.lolcommits/${PWD##*/}/$(git rev-parse HEAD | cut -c1-11).*)"
if [ "$?" -ne "0" ] || [ ! -f $FILE_PATH ]; then
lolcommits --capture --animate=1 --delay=4
FILE_PATH="$(ls ~/.lolcommits/${PWD##*/}/$(git rev-parse HEAD | cut -c1-11).*)"
GITHUB_REPO="$(git remote -v | grep origin | head -1 | sed 's/.*git@github\.com:\(.*\/.*\)\.git.*/\1/')"

Keybase proof

I hereby claim:

  • I am pfleidi on github.
  • I am pfleidi ( on keybase.
  • I have a public key whose fingerprint is 0187 FDE8 A967 B739 EE2B B857 48CB 26A0 5711 CE93

To claim this, I am signing this object:

View capy_test.rb
# Instead of globally disabling ignoring hidden elements like this
Capybara.configure do |config|
config.ignore_hidden_elements = false
# You can choose to selectively disable it on a per-call basis 'Foo', :from => 'Bar Selection', :visible => :all
Capybara.find :css, 'select#my_id', :visible => :all

Relation Management

One to One


  • Model1 explicitly belongs_to_one Model2 (via the model2 attribute)
  • Model2 implicitly has_one Model1

Model1 Example

pfleidi / Guardfile
Created Jun 27, 2013
Using rubber, Guard and pdflatex to build my thesis
View Guardfile
# encoding: utf-8
require 'guard/guard'
module ::Guard
class Thesis < ::Guard::Guard
def run_all
def run_on_changes(paths)