Skip to content

Instantly share code, notes, and snippets.

View gfontenot's full-sized avatar
football

Gordon Fontenot gfontenot

football
View GitHub Profile
@gfontenot
gfontenot / CleanDB.py
Created June 3, 2010 17:15
Python script to crawl the contents of your dropbox folder for Conflicted Copies
#!/usr/bin/env python
# encoding: utf-8
"""
CleanDB.py
Created by Gordon on 2010-06-03.
Copyright (c) 2010 Gordon Fontenot. All rights reserved.
"""
import sys
@gfontenot
gfontenot / UIImageManipulator.m
Created June 10, 2010 00:13
UIImageManipulator actions
#import "UIImageManipulator.h"
@implementation UIImageManipulator
static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight)
{
float fw, fh;
if (ovalWidth == 0 || ovalHeight == 0) {
CGContextAddRect(context, rect);
@gfontenot
gfontenot / gist:442306
Created June 17, 2010 15:55
Modification for FBDialog.m to trash cookies before asking permissions
if ([url isEqualToString:@"http://www.facebook.com/login.php"]) {
[cookies setCookie:testCookie]; // Create the test_cookie as required by login.php
} else if ([url isEqualToString:@"http://www.facebook.com/connect/prompt_permission.php"]) {
NSArray *cookieJar = [cookies cookies];
for (id aCookie in cookieJar) {
[cookies deleteCookie:aCookie];
}
}
@gfontenot
gfontenot / gist:724326
Created December 1, 2010 22:11
Method to change to NSFetchedResultsController dynamically
-(void)createFetchedResultsControllerWithSortOption:(NSInteger)sortOption animated:(BOOL)animated {
self.fetchedResultsController.delegate = nil;
self.fetchedResultsController = nil;
[fetchedResultsController release];
if (animated) {
NSMutableIndexSet *sectionsToDelete = [[NSMutableIndexSet alloc] init];
for (int i = 0; i < [self.tableView numberOfSections]; i ++) {
[sectionsToDelete addIndex:i];
}
@gfontenot
gfontenot / GrowlTodaysThings.script
Created December 10, 2010 17:37
Display tasks in the "Today" list of Things via a sticky growl notification
on run
tell application "Things"
set todoTitles to {}
repeat with toDo in to dos of list "Today"
set end of todoTitles to the name of toDo
end repeat
end tell
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "
"
-- Tweet current page in Chrome via Cloud.app and Twitter for mac
-- cobbled together by @gfontenot
--
-- Using most of the original code from:
-- »Get ShortURL via Cloud.app«
-- by @ptujec
--
-- using following sources:
-- http://www.leancrew.com/all-this/2007/11/long-and-shortened-url-scripts/
-- by @drdrang
tell application "Finder"
set the_file to selection
end tell
tell application "Yojimbo"
import the_file
end tell
@gfontenot
gfontenot / Instapaper-Yojimbo-Sync.rb
Created March 11, 2011 16:32
Ruby script to archive "liked" items to Yojimbo. Modified version of original script written by Rhet Turnbull
####!/usr/bin/ruby
# Ruby script to import an RSS feed, for example from InstaPaper or delicious, into Yojimbo
# Items already in the Yojimbo Library will not be re-imported unless you delete them from Yojimbo
# To use this, you'll need to install rb-appscript with the following two Terminal commands:
# sudo gem update --system
# sudo gem install rb-appscript
#
# If you get an with gem update, you may need to update your version of rubygems as follows:
# Get latest rubygems from http://rubyforge.org/projects/rubygems/
@gfontenot
gfontenot / Open Page In Chrome.scpt
Created March 14, 2011 16:52
Open the current Safari page in Google Chrome
tell application "Safari"
set the_url to URL of front document
end tell
tell application "Google Chrome"
try
set win to first window
on error
set win to make new window
end try
@gfontenot
gfontenot / main.scpt
Created April 15, 2011 16:40
Applescript core of a Honeypot application for use with Dropbox and Axel Bauer's isightcapture CLI
on run
tell (current date)
set currentDay to day
set currentMonth to month of it
end tell
set theDate to currentMonth & currentDay as string
set theIP to do shell script "/usr/bin/curl " & quoted form of "http://icanhazip.com"
set this_path to path to me as string