Skip to content

Instantly share code, notes, and snippets.

View zorn's full-sized avatar
💸
Elixir Contractor For Hire

Mike Zornek zorn

💸
Elixir Contractor For Hire
View GitHub Profile
@rdp
rdp / gist:519744
Created August 11, 2010 20:54
rake fails until you delete the original .gemspec file
C:\installs\trunk3_installed>cd bin
C:\installs\trunk3_installed\bin>rake -T
C:/installs/trunk3_installed/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
from C:/installs/trunk3_installed/bin/rake:19:in `<main>'
C:\installs\trunk3_installed\bin>cd ..
C:\installs\trunk3_installed>cat ./lib/ruby/gems/1.9.1/specifications/rake.gemspec
Gem::Specification.new do |s|
@BMorearty
BMorearty / gist:809775
Created February 3, 2011 16:59
How to reset the timezone after handling a request.
around_filter :set_time_zone
def set_time_zone
old_time_zone = Time.zone
Time.zone = current_user.time_zone if logged_in?
yield
ensure
Time.zone = old_time_zone
end
@adamvduke
adamvduke / Git Cheat Sheet
Created March 12, 2011 15:01
Corey Floyd's git cheat sheet
via: http://groups.google.com/group/phillycocoa/browse_thread/thread/2d05f3eac5a7d260?hl=en
revert file:
git checkout HEAD path/to/file
OR
git checkout filename
pluck one file from another branch
git checkout Branch path/to/file
@lukeredpath
lukeredpath / ExampleClass.m
Created June 30, 2011 22:18
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@zorn
zorn / gist:1172546
Created August 26, 2011 02:25
Things I wish the default Xcode unit testing did...
I wish code completion would work inside of STAssert*
I wish the console output would show number of asserts in addition to:
Executed 59 tests, with 0 failures (0 unexpected) in 0.999 (1.082) seconds
I wish the console would always be scrolled to the bottom and the current output (more of a general Xcode bug though).
I wish I didn't have to add a string to the end of every assert.
- (void)loadDefaultSettings
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]];
// other setup...
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]];
}
- (void)resetDefaultSettings
@zachwaugh
zachwaugh / gist:1264981
Created October 5, 2011 16:50
NSImage category for writing image to file
// [image writeToFile:[NSURL fileURLWithPath:@"/some/path/image.png"]];
- (void)writeToFile:(NSURL *)fileURL
{
NSBitmapImageRep *bitmapRep = nil;
for (NSImageRep *imageRep in [self representations])
{
if ([imageRep isKindOfClass:[NSBitmapImageRep class]])
{
bitmapRep = (NSBitmapImageRep *)imageRep;
def hidden_div_if(condition, attributes = {}, &block)
if condition
attributes["style"] = "display: none"
end
content_tag("div", attributes, &block) end
end
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#