Skip to content

Instantly share code, notes, and snippets.

View pfleidi's full-sized avatar

Sven Pfleiderer pfleidi

View GitHub Profile
bedtime:
sequence:
- 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
- id: '1600125859583'
alias: Sven's Closet Light
description: ''
trigger:
- entity_id: binary_sensor.door_sven_closet
from: 'off'
platform: state
to: 'on'
condition: []
action:
- id: '1601056415222'
alias: Living Room Night Light
description: ''
trigger:
- platform: state
entity_id: binary_sensor.motion_living_room
from: 'off'
to: 'on'
condition:
- 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.
require 'stringio'
require 'benchmark/ips'
list = 1...10_000
Benchmark.ips do |x|
x.config(:time => 10, :warmup => 2)
x.report('String#<<') do
s = ''
@pfleidi
pfleidi / pre-push
Last active August 29, 2015 14:03
Automatically make an animated GIF of yourself and upload it to a specified slack channel.
#!/bin/sh
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
fi
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 (https://keybase.io/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:

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

Relation Management

One to One

Constraints

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

Model1 Example

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