Skip to content

Instantly share code, notes, and snippets.

View phindmarsh's full-sized avatar

Patrick Hindmarsh phindmarsh

View GitHub Profile
@phindmarsh
phindmarsh / directives.js
Created August 24, 2012 00:50 — forked from abourget/directives.js
Hammer.js integration with AngularJS without the jQuery plugin
/**
* Inspired by AngularJS' implementation of "click dblclick mousedown..."
*
* This ties in the Hammer events to attributes like:
*
* hm-tap="add_something()"
* hm-swipe="remove_something()"
*
* and also has support for Hammer options with:
*
@phindmarsh
phindmarsh / gist:3838745
Created October 5, 2012 08:26
Photon Patch
@@ -527,20 +527,26 @@ function photon_cache_headers( $expires=63115200 ) {
$image = new Gmagick();
-$parsed = parse_url( $_SERVER['REQUEST_URI'] );
+$parsed = parse_url( substr($_SERVER['REQUEST_URI'], 1) );
$exploded = explode( '/', $_SERVER['REQUEST_URI'] );
$origin_domain = strtolower( $exploded[1] );
$origin_domain_exception = array_key_exists( $origin_domain, $origin_domain_exceptions ) ? $origin_domain_exceptions[$origin_domain] : 0;
@phindmarsh
phindmarsh / Vagrantfile
Created September 18, 2014 08:30
NFS issue when using Vagrant and Docker
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "docker" do |d|
d.vagrant_vagrantfile = "./Vagrantfile.proxy"
end
config.vm.define "container" do |v|
v.vm.provider "docker" do |d|
@phindmarsh
phindmarsh / MasqueradeGrant.php
Created April 28, 2015 03:13
Masquerade grant type
<?php
namespace MyApp\OAuth2\GrantType;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
use OAuth2\Storage\ClientCredentialsInterface;
use OAuth2\Storage\AccessTokenInterface;
@phindmarsh
phindmarsh / composer.json
Last active March 16, 2019 14:46
Composer Install Verbose Output
{
"name": "phindmarsh/composer-test",
"description": "Testcase for checking dependencies bug",
"require": {
"silex/silex": "dev-master#279c773342c6c4d141ebd5236b18518c96505e00"
},
"authors": [
{
"name": "Patrick Hindmarsh",
"email": "patrick@hindmar.sh"
@phindmarsh
phindmarsh / FacebookGrant.php
Last active July 2, 2016 16:20
Facebook Grant Type
<?php
namespace MyApp\OAuth2\GrantType;
use Facebook\FacebookRequest;
use Facebook\FacebookSession;
use Facebook\GraphUser;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
use OAuth2\Storage\ClientCredentialsInterface;
use OAuth2\Storage\AccessTokenInterface;
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diffs didn't match
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: reason: extra attributes: custom_cookbooks_source.0.ssh_key
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diff one: *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"name":*terraform.ResourceAttrDiff{Old:"project-dev", New:"project-dev S", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}}, Destroy:false, DestroyTainted:false}
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diff two: *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"custom_cookbooks_source.0.ssh_key":*terraform.ResourceAttrDiff{Old:"", New:"-----BEGIN RSA PRIVATE KEY-----\nSNIPPED\n-----END RSA PRIVATE KEY-----\n", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"project-dev", New:"project-dev S", NewComputed:fa
0482116d34e07db082acbf9878ece09f8e63957dc11f50f42e8697d0fad996bd734f21d71a58a975f4b1cfce21af27a8b17a56dc0700fbada96c57ee3987fb8815
@phindmarsh
phindmarsh / example.py
Created November 3, 2020 09:40
Clipsal/PDL Iconic BLE Dimmer
dimmer = WiserDimmer("XX:XX:XX:XX:C3:E0")
# turn dimmer on at full brightness
dimmer.state_on()
dimmer.level_set(10000)
# set level to 50% (min 0, max 10000)
dimmer.level_set(5000)
print(dimmer.level)
print(dimmer.state) # ON

Keybase proof

I hereby claim:

  • I am phindmarsh on github.
  • I am phindmarsh (https://keybase.io/phindmarsh) on keybase.
  • I have a public key whose fingerprint is 0F55 D5B9 A3B1 83EE CC53 DAAD 80E8 3ADC 9505 4362

To claim this, I am signing this object: