Skip to content

Instantly share code, notes, and snippets.

View maxehmookau's full-sized avatar

Max Woolf maxehmookau

View GitHub Profile
@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 / 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 / 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 / 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 / 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
name = 'Max'
if name.eql? 'Max'
puts 'Hi Max'
end
4.times do
puts 'Do this four times!'
end
@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

@maxehmookau
maxehmookau / Guardfile
Created May 6, 2013 14:18
Using Guard to run your OCUnit tests automatically.
guard 'shell' do
watch(/(.*).(m|h|mm|hh)/) do
puts "Change detected. Running tests..."
`../xctool/xctool.sh -project XCodeProject.xcodeproj -scheme MainScheme test -reporter plain`
end
end
@maxehmookau
maxehmookau / gist:5322387
Created April 5, 2013 20:30
This sucks, but there must be a better way to do it.
def humanised_time
if milliseconds < 60000
"#{ milliseconds / 1000 }sec"
elsif milliseconds > 60000 && milliseconds < 3600000
"#{ ((milliseconds / (1000 * 60)) % 60) }m #{ (milliseconds / 1000) % 60 }s"
else
"#{ ((milliseconds / (1000 * 60 * 60)) % 24) }h #{ ((milliseconds / (1000 * 60)) % 60) }m #{ (milliseconds / 1000) % 60 }s"
end
end