Skip to content

Instantly share code, notes, and snippets.

View dongyuwei's full-sized avatar
💭
天天听儿歌

dongyuwei dongyuwei

💭
天天听儿歌
View GitHub Profile
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
platform :osx, '10.9' # see https://github.com/CocoaPods/CocoaPods/issues/2075
target "NDTrieTest" do
pod 'Objective-LevelDB'
end
import urllib
URI = "http://google.com/complete/search?output=firefox&hl=en&q="
def suggest(term):
text = urllib.urlopen(URI + urllib.quote(term)).read()
arr = eval(text)
return arr[1]
print suggest("python")
export JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
if [ -f ./gradlew ]; then
./gradlew "$@"
else
gradle "$@"
fi
@dongyuwei
dongyuwei / testNSSpellChecker.m
Created June 18, 2014 09:58
test NSSpellChecker, show suggestion list for an uncorrect word.
#import <AppKit/NSSpellChecker.h> //import AppKit framework
void testSpellCheck(){
NSSpellChecker* checker = [NSSpellChecker sharedSpellChecker];
NSString * string = @"helo";
NSRange range = NSMakeRange(0, [string length]);
NSArray *corrected = [checker guessesForWordRange:range inString:string language:@"en" inSpellDocumentWithTag:0];
NSLog(@"NSSpellChecker suggestion:%@",corrected);
}
@dongyuwei
dongyuwei / IDEA-keymaps.xml
Created July 11, 2014 02:30
extracted from exported keymaps config(*.jar)
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Mac OS X copy" parent="Mac OS X">
<action id="CloseContent">
<keyboard-shortcut first-keystroke="meta F4" />
<keyboard-shortcut first-keystroke="meta W" />
</action>
<action id="DuplicatesForm.SendToLeft">
<keyboard-shortcut first-keystroke="meta 1" />
<keyboard-shortcut first-keystroke="meta T" />
</action>
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* To use: copy this file to ~/Library/KeyBindings/
* after that any Cocoa applications you launch will inherit these bindings
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
http://en.wiktionary.org/w/api.php?action=query&format=json&prop=revisions&rvprop=content&titles=test
@dongyuwei
dongyuwei / convert-img-color.sh
Last active August 29, 2015 14:05
replace all #c8102e color to #e4002b color in image
convert social-link-sprite.png -fuzz 20% -fill '#e4002b' -opaque '#c8102e' output.png
@dongyuwei
dongyuwei / keychain-access.sh
Last active August 29, 2015 14:05
keychain access from shell
security delete-generic-password -a David -s foobar-service-name
security add-generic-password -a David -s foobar-service-name -w my-password
security 2>&1 >/dev/null find-generic-password -ga David -s foobar-service-name
# see http://blog.macromates.com/2006/keychain-access-from-shell/
[[NSPasteboard generalPasteboard] clearContents];
[[NSPasteboard generalPasteboard] setString:@"test Pasteboard" forType:NSStringPboardType];
NSString* dataInPasteboard = [[NSPasteboard generalPasteboard] stringForType:NSStringPboardType];
NSLog(dataInPasteboard);