Skip to content

Instantly share code, notes, and snippets.

View pfleidi's full-sized avatar

Sven Pfleiderer pfleidi

View GitHub Profile
@pfleidi
pfleidi / fiberchat.rb
Created February 19, 2011 18:51
A naive socket chat using select() and ruby fibers
require 'rubygems'
require 'socket'
include Socket::Constants
class ChatServer
def initialize
@reading = Array.new
@writing = Array.new
@clients = Hash.new

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.
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
# 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)
after 'deploy:stop', 'puma:stop'
after 'deploy:start', 'puma:start'
after 'deploy:restart', 'puma:restart'
_cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
_cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
_cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
_cset(:puma_role) { :app }
namespace :puma do
Operating system: Linux
0.0.0 Linux 2.6.32-350-ec2 #57-Ubuntu SMP Thu Nov 15 15:59:03 UTC 2012 x86_64
CPU: amd64
family 6 model 26 stepping 5
2 CPUs
Crash reason: SIGSEGV
Crash address: 0x0
Thread 0 (crashed)