Skip to content

Instantly share code, notes, and snippets.

View michaeltwofish's full-sized avatar

Michael C. Harris michaeltwofish

  • South Australia, Australia
View GitHub Profile
@michaeltwofish
michaeltwofish / gist:1520033
Created December 25, 2011 23:47
Arduino LEDs
// Declare the pins backwards, so we can use pointer
// arithmetic without finding the end of the array
int ledPins[] = {9,8,7,6,5,4,3,2};
int pinCount = 8;
int highValue = 2 << (pinCount - 1);
void setup() {
// initialize the digital pins as an output.
for (int i = 0 ; i < pinCount; i++) {
pinMode(ledPins[i], OUTPUT);
@michaeltwofish
michaeltwofish / gist:1518597
Created December 25, 2011 01:17
cycling 8 LEDs
int ledPins[] = {2,3,4,5,6,7,8,9};
int duration = 100;
int inLeft[] = {0, 8, 1};
int inRight[] = {7, -1, -1};
void setup() {
// This is weird, inRight only works if I do this
Serial.begin(9600);
// initialize the digital pins as an output.
for (int i = 0 ; i < 8; i++) {
@michaeltwofish
michaeltwofish / habari_classes.txt
Created December 13, 2011 20:42
Proposed Habari PSR-0 layout
\Habari\System\Core\SuperGlobal => /System/Core/SuperGlobal.php
\Habari\System\Core\Version => /System/Core/Version.php
\Habari\System\Core\Update => /System/Core/Update.php
\Habari\System\Core\Session => /System/Core/Session.php
\Habari\System\Core\Singleton => /System/Core/Singleton.php
\Habari\System\Core\Site => /System/Core/Site.php
\Habari\System\Core\Config => /System/Core/Config.php
\Habari\System\Core\Controller => /System/Core/Controller.php
\Habari\System\Core\Options => /System/Core/Options.php
\Habari\System\Core\Error => /System/Core/Error.php
@michaeltwofish
michaeltwofish / gist:1416312
Created December 1, 2011 12:19 — forked from schappim/gist:1366104
LBE Workshop Notes
Get in contact with us:
[email protected] or [email protected] or [email protected]
02 8003 3523
http://www.littlebirdelectronics.com/facebook
http://twitter.com/lbhq
http://www.littlebirdelectronics.com/googleplus
Hackerspaces:
http://www.makehackvoid.com/ (Canberra)
bindkey -d -k kb stuff "\010"
term screen-256color
shell $SHELL
# use the hardstatus line for the window list
# alwayslastline - always display the hardstatus as the last line of the
# terminal
# "%{= kR} %-Lw" - change to a blac[k] background with bright [R]ed text,
# and print all the tab [w]indow numbers and titles in
# the [L]ong format (ie with flags) upto ('-') the
# current tab window
<?php if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); } ?>
<form
id="<?php echo $id; ?>"
method="<?php echo isset($method)?$method:'post'?>"
action="<?php echo $action; ?>"
class="<?php echo $class; ?>"
enctype="<?php echo $enctype; ?>"
accept-charset="<?php echo $accept_charset; ?>"
<?php echo $onsubmit; ?>
>
@michaeltwofish
michaeltwofish / gist:1366034
Created November 15, 2011 03:23
Always add a tag to a post
public function action_publish_post( $post, $form )
{
if ( $post->content_type == Post::type( 'mycontenttype' ) ) {
$post->tags .= ',mytag';
}
}
module Lithium
%w[rubygems net/http uri json].each {|lib| require lib}
def self.call(params)
endpoint = "http://local-oars/connection/rpc"
query = URI.escape(params.map {|k,v| "#{k}=#{v}"}.join('&'))
uri = URI.parse(endpoint + '?' + query)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request.initialize_http_header({"User-Agent" => "cucumber-lithium"})
Failing Scenarios:
cucumber -p client-admin-js client_admin/candidate_test_retrieve.feature:146 # Scenario: Open the filter tag form and then close it
cucumber -p client-admin-js client_admin/candidate_test_retrieve.feature:155 # Scenario: Select a tag to filter on and submit search
cucumber -p client-admin-js client_admin/candidate_test_retrieve.feature:175 # Scenario: Select a tag to filter on and submit search then submit again to see tag is still checked
cucumber -p client-admin-js client_admin/candidate_test_retrieve.feature:201 # Scenario: Apply two tags to a candidate that is tagged with both, and make sure it is listed only once
cucumber -p client-admin-js client_admin/candidate_test_retrieve.feature:218 # Scenario: Filter candidates by tag belonging to candidates for more than one client
cucumber -p client-admin-js client_admin/candidate_create.feature:182 # Scenario: Upload a file with a valid candidate
cucumber -p client-admin-js client_admin/candidate_create.feature:189 # Scenario: Upload a file w
@michaeltwofish
michaeltwofish / Custom.css
Created August 27, 2011 10:14 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*