Skip to content

Instantly share code, notes, and snippets.

View maxehmookau's full-sized avatar

Max Woolf maxehmookau

View GitHub Profile
@maxehmookau
maxehmookau / raspiairplay.md
Created July 2, 2013 19:04
How to turn a Raspberry Pi in to an AirPlay Server

How to turn a Raspberry Pi in to an AirPlay Server

$ ssh [email protected]
Enter Password: raspberry

$ sudo raspi-config
Choose 'Repurpose entire SD card'

Update apt repositories

4.times do
puts 'Do this four times!'
end
name = 'Max'
if name.eql? 'Max'
puts 'Hi Max'
end
@maxehmookau
maxehmookau / sublime.json
Created October 2, 2013 09:00
My Sublime Text 3 Config
{
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"font_face": "Anonymous Pro",
"font_size": 16,
"ignored_packages":
[],
"margin": 2,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"use_simple_full_screen": true
@maxehmookau
maxehmookau / controllers.js
Created October 15, 2013 20:22
Angular Step One
function CartController($scope) {
$scope.items = [
{ name: 'Fish', quantity: 0, price: 20.00 },
{ name: 'Chips', quantity: 0, price: 0.20 }
];
$scope.total = function() {
var total = 0;
for(var i = 0; i < $scope.items.length; i++) {
total = total + ($scope.items[i].quantity * $scope.items[i].price);
@maxehmookau
maxehmookau / tea.coffee
Created April 1, 2014 08:25
April fool tea making bot
module.exports = (robot) ->
robot.respond /who should make tea\??/i, (msg) ->
msg.send "@SamKnight should make tea"
@maxehmookau
maxehmookau / 0_reuse_code.js
Created June 8, 2014 20:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@maxehmookau
maxehmookau / stack.m
Created July 11, 2014 13:21
Objective-C BDD
#import "Kiwi.h"
#import "RPNStack.h"
SPEC_BEGIN(RPNStackSpec)
describe(@"The stack", ^{
context(@"when created", ^{
RPNStack *stack = [[RPNStack alloc] init];
it(@"is not nil.", ^{
[[stack shouldNot] beNil];
@maxehmookau
maxehmookau / NSNumber+Additions.m
Created August 7, 2014 10:33
Convert military time to NSDate (NSNumber Category)
- (NSDate *)sub_DateFromMilitaryTime {
NSDate *newDate;
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setMinute:[self intValue] % 100];
[comps setHour:floor(self.intValue / 100)];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
newDate = [gregorian dateFromComponents:comps];
return newDate;
}
@maxehmookau
maxehmookau / NSNumber+SUBNumberAdditions.h
Created August 29, 2014 14:00
Objective-C Categories for Converting NSNumber containing military time to NSDate
#import <Foundation/Foundation.h>
@interface NSNumber (SUBNumberAdditions)
- (NSDate *)sub_DateFromMilitaryTime;
- (BOOL)sub_isValidMilitaryTime;
@end