Skip to content

Instantly share code, notes, and snippets.

@joncooper
joncooper / gist:1317326
Created October 26, 2011 18:38
launch iOS simulator from rake task
def try_to_launch_simulator(target)
ios_sim = `which ios-sim`.strip
if ios_sim.empty?
puts "Please install ios-sim:"
puts "brew install ios-sim, or https://github.com/Fingertips/ios-sim"
exit
else
system_or_exit(%Q[#{ios_sim} launch "#{File.join(build_dir("-iphoneSimulator"), "#{target}")}" --sdk 5.0 --family iphone --stdout /dev/null --stderr /dev/null])
`osascript -e 'tell application "iPhone Simulator" to activate'`
end
@joncooper
joncooper / bootstrap.html
Created November 15, 2011 18:22
chrome-pt-blog-1
<html>
<head>
<script>
<!-- Inject the content script -->
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(null, { file: "jquery.min.js" }, function() {
chrome.tabs.executeScript(null, { file: "ptcx.js" });
});
});
@joncooper
joncooper / resize_message_recv.js
Created November 15, 2011 21:56
chrome-pt-blog-2
<!-- Force a reflow of the page by changing its dimensions. -->
var redraw = function() {
chrome.windows.getLastFocused(function(window) {
var dimensions = {};
dimensions.width = window.width;
dimensions.height = window.height;
dimensions.left = window.left;
dimensions.top = window.top;
@joncooper
joncooper / gist:1371094
Created November 16, 2011 19:37
lorem-tracker.rb
PivotalTracker::Client.token = API_TOKEN
@tracker_project = PivotalTracker::Project.find(PROJECT_ID)
fake_story = {
:name => 'This is a story title.',
:story_type => 'feature',
:current_state => 'unstarted',
:labels => ['label1', 'label2'],
:description => 'This is the story description. Blah blah blah.',
:estimate => 1
require 'bundler'
Bundler.require
IPSUM_FILE = 'hipster-ipsum.txt'
IPSUM_TEXT = File.readlines(IPSUM_FILE)
API_TOKEN = ENV['API_TOKEN']
PROJECT_ID = ENV['PROJECT_ID'].to_i
STORY_COUNT = ENV['STORY_COUNT'].to_i
@joncooper
joncooper / Image.go
Created November 17, 2011 19:56
blog-instashred
type Image interface {
image.Image
Set(x, y int, c image.Color)
}
_ /|
\'o.O'
=(___)=
U ack --thppt!