Skip to content

Instantly share code, notes, and snippets.

View egold's full-sized avatar
🐒
...

Eric Goldberg egold

🐒
...
View GitHub Profile
@egold
egold / gist:2188971
Created March 24, 2012 23:16
Temporarily set gcc to point to GCC 4.2 instead of LLVM
# This gist is a small recipe for temporarily making your Lion box point to GCC 4.2 instead of LLVM, like for things such as Ruby, which isn't yet made to compile on the newer and better LLVM
# First make sure you've installed Command Line Tools from Xcode 4.3 preferences
cd /usr/bin/
ls -l *gcc*
# Important: Only do this if gcc is a symlink to llvm! if not, this gist isn't the way to go! :)
# It should look like this:
@egold
egold / gist:2294834
Created April 3, 2012 19:15
Quickie NSArray sorting
NSSortDescriptor* sortByDate = [NSSortDescriptor sortDescriptorWithKey:@"createdDate" ascending:NO];
allReminders = [allReminders sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortByDate]];
self.reminders = [NSMutableArray arrayWithArray:allReminders];
%w(app as).each do |role|
desc "Adds #{role} to the target roles for the task"
task(role) do
if ENV['ROLES']
ENV['ROLES'] += ",#{role}"
else
ENV['ROLES'] = role
end
end
end
@egold
egold / gist:b2259dcf6a69852f1b3f
Created August 29, 2014 19:05
Script to kill beanstalkd jobs
ubuntu@ip-10-123-151-236:~$ cat beanstalk-purge
#!/usr/bin/expect -f
# Filename: beanstalk-purge
set timeout 1
spawn telnet [lindex $argv 0] [lindex $argv 1]
sleep 1
send "use [lindex $argv 2]\n"
expect "USING"
@egold
egold / gist:300b0826b4a77aa0de35
Last active August 29, 2015 14:17 — forked from iwasrobbed/gist:5528897
Fixes incorrect variable on line 44
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;