Skip to content

Instantly share code, notes, and snippets.

View fannheyward's full-sized avatar
🎯
Slow to response

Heyward Fann fannheyward

🎯
Slow to response
View GitHub Profile
@fannheyward
fannheyward / build_universal_library.sh
Last active October 12, 2015 17:47 — forked from adamgit/gist:3705459
Automatically create cross-platform (simulator + device) static libraries for Objective C / iPhone / iPad
##########################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.7
#
# Latest Change:
# - Supports iPhone 5 / iPod Touch 5 (uses Apple's workaround to lipo bug)
#
# Purpose:
@fannheyward
fannheyward / TWRequest+OAuthEcho.h
Created March 21, 2012 08:15
Add OAuth Echo methods to TWRequest
#import <Twitter/Twitter.h>
#import <Accounts/Accounts.h>
@interface TWRequest (OAuthEcho)
/*
* code example:
*
* NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1/account/verify_credentials.json"];
@fannheyward
fannheyward / picky2octopress.rb
Created November 30, 2011 07:51
Import XML of Picky to Octopress
# -*- coding: utf-8 -*-
require 'fileutils'
require 'date'
require 'yaml'
require 'uri'
require 'rexml/document'
include REXML
doc = Document.new File.new(ARGV[0])
@fannheyward
fannheyward / picky_rss_out.xml
Created November 30, 2011 07:48
Picky RSS export out.xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ site_name }}</title>
<subtitle>{{ site_slogan }}</subtitle>
<link rel="alternate" type="text/html" href="http://{{ site_domain }}/" />
<link rel="self" type="application/atom+xml" href="{{ feed_url }}" />
<id>http://{{ site_domain }}/</id>
<updated>{{ site_updated }}</updated>
<rights>Copyright © 2009-2010, {{ site_author }}</rights>
{% for article in articles %}
@fannheyward
fannheyward / RSSOutHandler.py
Created November 30, 2011 07:42
Picky RSSOutHandler
class RSSOutHandler(webapp.RequestHandler):
def get(self):
site_domain = Datum.get('site_domain')
site_name = Datum.get('site_name')
site_author = Datum.get('site_author')
site_slogan = Datum.get('site_slogan')
site_analytics = Datum.get('site_analytics')
site_updated = Datum.get('site_updated')
if site_updated is None:
site_updated = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
@fannheyward
fannheyward / download video from 3g.sina
Created November 29, 2011 02:55
从 3g.sina 下载视频。
javascript:(function(){window.open('http://3g.sina.com.cn/3g/site/proc/video/show_convert_video.php?url='+encodeURIComponent(location.href)+'&vt=4');})()
// DLog is almost a drop-in replacement for NSLog
// DLog();
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
property growlAppName : "Growl iChat"
property notificationNames : {"Buddy Became Available", ¬
"Buddy Became Unavailable", ¬
"Message Received", ¬
"Completed File Transfer"}
property defaultNotificationNames : {"Buddy Became Available", ¬
"Buddy Became Unavailable", ¬
"Message Received", ¬
"Completed File Transfer"}
@fannheyward
fannheyward / iChatGrowl.applescript
Created September 5, 2011 08:01
Save this AppleScript to “~/Library/Scripts/iChat/Growl.applescript”. via http://amccloud.com/lion-ichat-growl-notifications-50108
using terms from application "iChat"
on message received message from theBuddy for textChat
set whoDidIt to full name of theBuddy
set buddyIcon to image of theBuddy
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
end tell
tell application frontApp
set window_name to name of front window
end tell
@fannheyward
fannheyward / iPhone Done like button
Created August 30, 2011 02:11
iPhone Done like button
doneButton.frame = CGRectMake(5, 27, 48, 30);
doneButton.backgroundColor = [UIColor clearColor];
UIImage *buttonImageNormal = [UIImage imageNamed:@"doneButton.png"];
UIImage *stretchableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:5 topCapHeight:0];
[doneButton setBackgroundImage:stretchableButtonImageNormal forState:UIControlStateNormal];