Skip to content

Instantly share code, notes, and snippets.

{ scopeName = 'source.haxe';
fileTypes = ( 'hx' );
foldingStartMarker = '(/\*\*|\{\s*$)';
foldingStopMarker = '(\*\*/|^\s*\})';
patterns = (
{ name = 'support.class.haxe.flash';
match = '(flash.)?\b(Accessibility|Boot|Button|Camera|Color|ContextMenu|ContextMenuItem|ExtendedKey|Key|Lib|LoadVars|LocalConnection|Microphone|Mouse|MovieClip|MovieClipLoader|NetConnection|NetStream|PrintJob|Selection|SelectionListener|SharedObject|Sound|Stage|System|TextField|TextFormat|TextSnapshot|Video|XMLRequest|XMLSocket)\b';
},
{ name = 'support.class.haxe.flash.display';
match = '(flash.display.)?\b(BitmapData)\b';
tell application "FanRadio"
set s to current track
end tell
tell application "Adium"
go away with message s
end tell
@du-song
du-song / hosts
Created July 3, 2011 14:03
/etc/hosts for Google in China
203.208.46.178 googleusercontent.com webcache.googleusercontent.com themes.googleusercontent.com www.google.com.hk docs.google.com images.google.com encrypted.google.com groups.google.com clients2.google.com feedproxy.google.com spreadsheets.google.com picasaweb.google.com sites.google.com plus.google.com mail.google.com apis.google.com maps.google.com www.google.com gg.google.comencrypted-tbn1.google.com mts0.google.com mts1.google.com
@du-song
du-song / RestartMail.applescript
Created July 25, 2011 01:42
Restart Mail everyday
--- Restart Mail everyday!
--- 12 12 * * * osascript /scripts/RestartMail.applescript >/tmp/Mail.log 2>&1 &
on run
try
tell application "System Events" to set MailRun to (count of (every process whose name is "Mail")) > 0
if MailRun then
tell application "Mail" to quit
do shell script "sleep 5"
tell application "Mail" to open
end if
@du-song
du-song / known_xauth_keys.yml
Created November 23, 2011 06:46
Known Weibo XAuth Keys
known_xauth_keys:
- name: "Air微博"
version: "1.8.4"
consumer_key: "313042886"
consumer_secret: "f52136f5036559b45e171f2e0335613d"
@du-song
du-song / simple.pac
Created December 16, 2011 20:30
relatively short PAC file for bypassing GFW and blocking ads on iPhone.
function FindProxyForURL(url, host) {
var p = "PROXY example.server:1989";
if (shExpMatch(host, "*twitter.com*")) return p;
if (shExpMatch(host, "*t.co")) return p;
if (shExpMatch(host, "*bit.ly")) return p;
if (shExpMatch(host, "*j.mp")) return p;
if (shExpMatch(host, "*facebook.com*")) return p;
if (shExpMatch(host, "*facebook.net*")) return p;
if (shExpMatch(host, "*fbcdn.net")) return p;
if (shExpMatch(host, "*twimg.com")) return p;
@du-song
du-song / signipa.sh
Created January 24, 2012 11:13
Sign IPA with installed Apple developer license
#!/bin/sh
#
# detail in blog post: http://blog.rollingcode.org/2010/07/28/sign-ipa-with-installed-developer-license/
#
SAVEDIR=`pwd`
WORKDIR=/tmp/ipa_$RANDOM$RANDOM
WORKIPA=/tmp/ipa_$RANDOM$RANDOM.ipa
echo Unpacking $1 to $WORKDIR
mkdir -p $WORKDIR
@du-song
du-song / gist:1842466
Created February 16, 2012 05:56
Calibre Chapter Detection Setting
//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter' or re:test(., '^\s*.{0,2}[一二三四五六七八九十百千上中下序]+[部章节篇].{0,50}', '')]
@du-song
du-song / fack.py
Created August 2, 2012 06:09
fack - free from arguable code style
#!/usr/bin/python
import sys, re, subprocess
a = sys.argv[1].split("_")
subprocess.call("ack -i " + sys.argv[1] + "\\|" + (''.join(a) if (len(a)>1) else re.sub(r'([a-z]*)([A-Z])', r'\1_\2', a[0])), shell=True)
# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input