This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "yaml" | |
stash_list = `git stash list`.chomp.split("\n").map {|i| i.chomp } | |
stash_list.map!{|s| | |
b = s.match(/stash@\{([0-9]+)\}: (.*)/) | |
[b[1], b[2]] | |
} | |
stash_list.each do |s| | |
puts "{#{s[0]}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define KMProfile(MSG, CODE_TO_PROFILE) { \ | |
NSDate *KMStartDate = [NSDate date]; \ | |
NSTimeInterval KMduration; \ | |
CODE_TO_PROFILE \ | |
KMduration = [[NSDate date] timeIntervalSinceDate:KMStartDate]; \ | |
NSLog(@"KMProfile: %@ TOOK %.0lfms (%.1lfs) ", MSG,(KMduration*1000) , KMduration); \ | |
} | |
// Usage: (works well with something a bit more intensive but you get the gist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# 2011-10-10 20:57:53 +1000 | |
def merge_sort a | |
return a if a.size <= 1 | |
l,r = split_array a | |
result = combine merge_sort(l), merge_sort(r) | |
end | |
def split_array a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property phoneNumber : "55522332" | |
tell application "Skype" to activate | |
delay 20 | |
tell application "System Events" | |
tell application process "Skype" | |
try | |
tell window "Dial Pad" to click | |
tell window "Dial Pad" | |
keystroke phoneNumber | |
click button "Call" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#define LOGV(V) NSLog(@"%s = %@", #V, V); | |
#define LOGD(I) NSLog(@"%s = %d", #I, I); | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool | |
{ | |
dispatch_queue_t dqueue = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)visibleWindows | |
{ | |
if (!visibleWindows) | |
{ | |
// do what ever here to reopen your window | |
[[CoverStoryDocumentController sharedDocumentController] openDocument:self]; | |
return NO; | |
} | |
return YES; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'date' | |
require 'nokogiri' | |
URL = "https://developer.apple.com/wwdc/" | |
MP3 = "~/Projects/wwdc-check/giants.mp3" | |
found = false | |
def wwdc_is_here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool | |
{ | |
NSOperationQueue *queue = [[NSOperationQueue alloc] init]; | |
queue.maxConcurrentOperationCount = 1; | |
__block NSBlockOperation *operation = [[NSBlockOperation alloc] init]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
doc = Nokogiri::HTML(File.open("Videoswwdc.html")) | |
items = {} | |
doc.xpath("//li[@class='session']").each do |session| | |
session_id = session['id'].sub('-video', '').to_i | |
title = session.children.xpath("li[@class='title']").text | |
items[session_id] = title | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
doc = Nokogiri::HTML(File.open("Videoswwdc.html")) | |
items = {} | |
doc.xpath("//li[@class='session']").each do |session| | |
session_id = session['id'].sub('-video', '').to_i | |
title = session.children.xpath("li[@class='title']").text | |
items[session_id] = title | |
end |
OlderNewer