Skip to content

Instantly share code, notes, and snippets.

View buymeasoda's full-sized avatar

Ian Hill buymeasoda

View GitHub Profile
@buymeasoda
buymeasoda / gist:e4dbefaca78521c75f9e
Created February 22, 2015 04:24
Add buttons to right bar button item
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 44.0f)];
self.countLabel = [[UILabel alloc] init];
self.countLabel.text = [self characterCountRemaining:0];
[self.countLabel sizeToFit];
UIBarButtonItem *countLabelItem = [[UIBarButtonItem alloc] initWithCustomView:self.countLabel];
UIBarButtonItem *tweetButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Tweet" style:UIBarButtonItemStylePlain target:self action:@selector(onTweet)];
[toolBar setItems:@[countLabelItem, tweetButtonItem] animated:NO];
@buymeasoda
buymeasoda / prism-node.js
Created January 15, 2013 07:04
Node version of prism.js
var Prism,
self = {
addEventListener: function () {},
set Prism(implementation) {
Prism = implementation;
}
};
/***********************************************
Begin prism-core.js
@buymeasoda
buymeasoda / button_test.ino
Created August 16, 2012 09:43
Arduino IDE and Johnny-five based test scripts of button and led
/*
Running the following script via the Arduino IDE and uploading it to the board works correctly.
The in-built LED on pin 13 lights up when the button is pressed and turns off when the button is released.
*/
const int buttonPin = 7;
const int ledPin = 13;
int buttonState = 0;