This file contains hidden or 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
| alert('hello from gist'); |
This file contains hidden or 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
| function hyphenize(string) { | |
| string = string.replace(/[^A-Za-z0-9\. -]/g, ''); | |
| return string.replace(/ */g, '-'); | |
| } | |
| var str = "Nike The Future One / Interactive Setting" | |
| hyphenize(str) | |
| // "Nike-The-Future-One-Interactive-Setting" |
This file contains hidden or 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
| struct Drag { | |
| static var placeholderView: UIView! | |
| static var sourceIndexPath: NSIndexPath! | |
| } | |
| func handleLongPress(gesture: UILongPressGestureRecognizer) { | |
| let point = gesture.locationInView(tableView) | |
| let indexPath = tableView.indexPathForRowAtPoint(point) | |
| switch gesture.state { |
This file contains hidden or 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
| var url = 'https://tw.bid.yahoo.com/tw/0-all.html?.r=1432872568' | |
| var cheerio = require('cheerio') | |
| var https = require('https') | |
| https.get(url, function(response) { | |
| var responseData = "" | |
| response.setEncoding('utf-8') | |
| response.on('data', function(data){ | |
| responseData += data | |
| }) |
This file contains hidden or 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
| - (void)dumpAllSelector:(Class) SomeClass | |
| { | |
| id t = [[SomeClass alloc] init]; | |
| int i=0; | |
| unsigned int mc = 0; | |
| Method * mlist = class_copyMethodList(object_getClass(t), &mc); | |
| NSLog(@"%d methods", mc); | |
| for(i=0;i<mc;i++) | |
| NSLog(@"Method no #%d: %s", i, sel_getName(method_getName(mlist[i]))); |
This file contains hidden or 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
| set fish_git_dirty_color red | |
| set fish_git_not_dirty_color green | |
| function parse_git_branch | |
| set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/') | |
| set -l git_diff (git diff) | |
| if test -n "$git_diff" | |
| echo (set_color $fish_git_dirty_color)$branch(set_color normal) | |
| else |
This file contains hidden or 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
| #screen setting | |
| #cjkwidth off | |
| startup_message off | |
| #support 256 color | |
| termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
| #statusbar | |
| caption always "%{=u .r} %-w%<%{=ub .Y}%n %t%{=u .r}%+w " | |
| hardstatus alwaysignore |