Skip to content

Instantly share code, notes, and snippets.

View larryaasen's full-sized avatar

Larry Aasen larryaasen

View GitHub Profile
@larryaasen
larryaasen / gist:5035313
Created February 26, 2013 02:29
Using the Xcodeproj Ruby Gem - open exising Xcode project, add a file to the project in the main group, add the file to the main target, and save the Xcode project file.
# Open the existing Xcode project
project_file = product_name + '.xcodeproj'
project = Xcodeproj::Project.new(project_file)
# Add a file to the project in the main group
file_name = 'Message.m'
group_name = product_name
file = project.new_file(file_name, group_name)
# Add the file to the main target
@larryaasen
larryaasen / gist:5104501
Last active December 14, 2015 14:59
A simple C function to submit a block for asynchronous execution on the main queue (main thread).
void dispatch_async_on_main_queue(dispatch_block_t block);
/*
* Submits a block for asynchronous execution on the main queue (main thread).
*/
void dispatch_async_on_main_queue(dispatch_block_t block)
{
dispatch_async(dispatch_get_main_queue(), block);
}
@larryaasen
larryaasen / gist:5107571
Created March 7, 2013 12:02
Showing the hidden files in the Finder app on Mac OS X 10.8 requires a change to the Finder user defaults. Enter this command in a Terminal window.
defaults write com.apple.Finder AppleShowAllFiles YES
@larryaasen
larryaasen / gist:5129807
Created March 10, 2013 18:44
Change the Mac OS X Screen Capture Folder
# Change the Mac OS X Screen Capture Folder
$ defaults write com.apple.screencapture location ~/Screenshots
$ killall SystemUIServer
@larryaasen
larryaasen / gist:5145033
Created March 12, 2013 17:31
On Mac OS X Mountain Lion (10.8) with Xcode 4.6 use this line to compile Ruby 1.9.3. This worked for me using rvm 1.18.18, ruby-1.9.3-p392, and Mac OS X 10.8.2.
# On Mac OS X Mountain Lion with Xcode 4.6 use this line to compile Ruby 1.9.3:
$ rvm install 1.9.3 --with-gcc=gcc
@larryaasen
larryaasen / gist:5197438
Last active December 15, 2015 03:49
Remember to run this comment before running ssh-add.
# Remember to run this comment before running ssh-add
$ eval `ssh-agent`
Agent pid 22828
$ ssh-add -l
@larryaasen
larryaasen / gist:5403964
Created April 17, 2013 12:48
UIDevice+LAExtras - vibrate the device and get the OS name and version.
//
// UIDevice+LAExtras.h
// Konugo
//
// Created by Larry Aasen on 3/26/13.
//
//
#import <UIKit/UIKit.h>
@larryaasen
larryaasen / gist:5501941
Created May 2, 2013 12:41
Changing the folder of screenshots on Mac OS X.
defaults write com.apple.screencapture location ~/Screenshots
killall SystemUIServer
@larryaasen
larryaasen / gist:5535522
Created May 7, 2013 19:43
Installing CocoaPods from the command line.
# 1. Install CocoaPods from the command line in the Terminal app on your Mac.
$ sudo gem install cocoapods
$ pod setup
@larryaasen
larryaasen / gist:5583748
Created May 15, 2013 12:45
Creating a screenshot of the Mac OS X 10.8.3 login screen.
sudo screen -m -d bash -c "sleep 20; screencapture /Users/larryaasen/Desktop/loginscreen.png"