Skip to content

Instantly share code, notes, and snippets.

View thetron's full-sized avatar
⌨️
Clack clack clack

Nicholas Bruning thetron

⌨️
Clack clack clack
View GitHub Profile
@thetron
thetron / keybase.md
Created December 7, 2015 23:52
Keybase proof

Keybase proof

I hereby claim:

  • I am thetron on github.
  • I am thetron (https://keybase.io/thetron) on keybase.
  • I have a public key whose fingerprint is C51C B085 A284 C95A 724F F5EB D429 C136 4BF5 EFCA

To claim this, I am signing this object:

@thetron
thetron / coaches_mail.txt
Last active October 13, 2015 00:28 — forked from jomontanari/coaches_mail.txt
RG Melbs Coaches Mail
Hi Coaches!
We are so glad to have you on board for Rails Girls this weekend. Here are further details of our schedule for Friday and Saturday, and what to expect. We will also invite you all to our Slack group, so if you have any questions at all please feel free to contact us via email, phone or in Slack.
As with all Ruby Australia events we're bound by the Ruby Australia code of conduct (found at: http://ruby.org.au/code-of-conduct.html), let's hope we don't need it but please do make sure you know who the orgnaisers are and be at least familiar with the document.
The event is at REA, 511 Church Street, Richmond 3121 - you'll see the REA logo on the building. Head to the front door and there will be somebody to let you in - if you can't see anyone, please call Kate (0409 337 107) or Jo (0428 190 881).
We'll kick off around 6pm on Friday, so it would be great if you can make it over to REA by 5:30pm to get set up. We understand that might not be possible for all of you, so we'll try and make sure you ha
@thetron
thetron / config.rb
Last active August 31, 2015 20:43
Middleman Rails Assets config
# config.rb
after_configuration do
if defined?(RailsAssets)
RailsAssets.load_paths.each do |path|
sprockets.append_path path
end
end
end
@thetron
thetron / book.html
Last active August 29, 2015 14:08
Mimicking iOS's missing cover art in CSS and HTML
<a href="#" class="cover">
<p class="title">
<span class="primary">
{{title}}
</span>
{{subTitle}}
</p>
<div class="art"></div>
</a>
@thetron
thetron / address.rb
Created February 4, 2014 04:42
Multiple polymorphic joins in Rails
# app/models/address.rb
class Address < ActiveRecord::Base
belongs_to :addressable, polymorphic: true
end
@thetron
thetron / Run Script
Created November 24, 2011 00:38
Automatic, Apple-style build numbers
#!/usr/bin/env ruby
bundle_version_short = %x{/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE"}
bundle_version = %x{/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE"}
build_number = bundle_version_short.split(".").first
build_number += (bundle_version_short.split(".")[1].to_i + 65).chr
build_number += (bundle_version.scan(/\d+[A-Z](\d+)/).flatten.first.to_i + 1).to_s
%x{/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{build_number}" "$INFOPLIST_FILE"}
@thetron
thetron / SGWMScrollView.h
Created October 21, 2011 06:49
SGWMScrollView
//
// SGWMScrollView.h
// SmartGardenWateringMobile
//
// Created by Nicholas Bruning on 21/10/11.
// Copyright (c) 2011 Involved. All rights reserved.
//
#import <UIKit/UIKit.h>
NSManagedObjectContext *managedObjectContext = ((SGWMAppDelegate *)[UIApplication sharedApplication].delegate).managedObjectContext;
NSPersistentStoreCoordinator *persistentStoreCoordinator = ((SGWMAppDelegate *)[UIApplication sharedApplication].delegate).persistentStoreCoordinator;
[persistentStoreCoordinator lock];
[managedObjectContext save:&error];
[persistentStoreCoordinator unlock];
@thetron
thetron / carrierwave.rb
Created June 8, 2011 05:05
Carrierwave (0.5.4) monkey patch to remove version name from saved files
# config/initializers/carrierwave.rb
module CarrierWave
module Uploader
module Versions
private
def full_filename(for_file)
super(for_file)
end
end
# lib/active_record_ext.rb
module ActiveRecordExtensions
def self.included(base)
base.extend(ClassMethods)
end
# attempts to create an 'html-friendly' id
def to_html_param(include_class_name = true)
if include_class_name