Skip to content

Instantly share code, notes, and snippets.

View skwashd's full-sized avatar
👨‍💻
planning, coding, reviewing

Dave Hall skwashd

👨‍💻
planning, coding, reviewing
View GitHub Profile
blueprint:
name: ZHA - Moes Smart Knob for lights (RGB cycle + optional double‑press)
description: >
Fork of GonzaloAlbito’s original blueprint, modified to add **hue cycling** on
press‑and‑hold and (optionally) a custom **double‑press** action while keeping
the original brightness‑dimming logic and reliability work‑arounds (repeat
loops, service_template, data_template).
• **Rotate** → brightness ±*Light step* % per encoder tick.
• **Press & hold** → every `step_color_temp` or `move_hue` event (depends on
; Example drush make file using the github download type.
api = 2
core = 7
projects[] = drupal
; Module
projects[bean_boxes][type] = "module"
projects[bean_boxes][download][type] = "github"
@skwashd
skwashd / typecast.php
Created June 24, 2012 07:16 — forked from berkes/typecast.php
gotcha with PHP typecasting
<?php
$amount = 12.50;
print (int) $amount * 100; # => 1200 # My implementation. I was wrong.
print (int) ($amount * 100); # => 1250 # After bugfix. PHP first casts, then multiplies.