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
Show hidden characters
{ | |
"cmd": ["node", "$file"], | |
"selector": "source.js", | |
"path": "/usr/local/bin" | |
} |
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
NSCalendar* cal = [NSCalendar currentCalendar]; | |
NSDateComponents* comp = [cal components:NSWeekdayCalendarUnit fromDate:[NSDate date]]; | |
return [comp weekday]; // 1 = Sunday, 2 = Monday, etc. |
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
PATH=/usr/local/bin:/usr/bin | |
# MAILTO=hank | |
# min hour day month weekday command | |
# * * * * * * | |
*/1 * * * * script.sh # 每一分鐘 | |
10 10 * * * script.sh # 每天早上 10:10 | |
10 10 1 * * script.sh # 每個月第一天的 10:10 | |
30 9 * * 1-5 script.sh # 週一到週五 09:30 | |
0 12 * * sub script.sh # 週日 12:00 |
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
// from : https://github.com/jhwilson/Create-a-Blogger-archive-page | |
/* Usage: | |
<script type="text/javascript" src="http://cloud.github.com/downloads/jhwilson/Create-a-Blogger-archive-page/Make-Blogger-Archive-Page.js"></script> | |
<script src="http://myblogid.blogspot.tw/feeds/posts/default?max-results=500&alt=json-in-script&callback=LoadTheArchive"> </script> | |
*/ | |
function LoadTheArchive(TotalFeed) | |
{ | |
var PostTitles = new Array(); | |
var PostURLs = new Array(); |
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
#include <stdio.h> | |
int GCD(int, int); | |
void main(void) { | |
printf("%d\n",GCD(99, 55)); | |
system("pause"); | |
} | |
int GCD(int x, int y) { |
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
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB |
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
// | |
// AppDelegate.m | |
// | |
- (void)applicationDidEnterBackground:(UIApplication *)application | |
{ | |
NSDate *alertTime = [[NSDate date] | |
dateByAddingTimeInterval:10]; | |
NSDate *alertTime2 = [[NSDate date] | |
dateByAddingTimeInterval:30]; |
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
UIApplication *app = [UIApplication sharedApplication]; | |
NSArray *events = [app scheduledLocalNotifications]; | |
cancelNid = @"1"; | |
for (int i=0; i<[events count]; i++) | |
{ | |
UILocalNotification* notify = [eventArray objectAtIndex:i]; | |
NSString *uid = [NSString stringWithFormat:@"%@",[notify.userInfo valueForKey:@"nid"]]; | |
if ([nid isEqualToString:cancelNid]) |
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 toLoop = new Array(1000); | |
for (var i = 0; i < toLoop.length; i++) { | |
// BAD - the length has to be evaluated 1000 times | |
} | |
for (var i = 0, len = toLoop.length; i < len; i++) { | |
// GOOD - the length is only looked up once and then cached | |
} |
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 d=window.open().document; | |
d.write("<html><body><h1>Hi!</h1> Test!</body></html>"); | |
d.close(); |