Skip to content

Instantly share code, notes, and snippets.

View JohnnyTseng's full-sized avatar
🏠
Working from home

Johnny Tseng JohnnyTseng

🏠
Working from home
View GitHub Profile
@JohnnyTseng
JohnnyTseng / BeautyLogFormmater.swift
Last active June 17, 2020 13:59
CocoaLumberJack - Swift Custom Formatter Sample
import Foundation
import CocoaLumberjack
class BeautyLogFormmater: NSObject, DDLogFormatter {
public func format(message logMessage: DDLogMessage) -> String? {
var logLevel: String = ""
switch logMessage.flag {
@JohnnyTseng
JohnnyTseng / data.json
Last active September 25, 2018 15:45
台鐵站名 & 代號 Group by 地區
// Last modify: 2018/09/25
// Data source: http://twtraffic.tra.gov.tw/twrail/TW_Quicksearch.aspx & http://ptx.transportdata.tw/PTX
// Please always check if this data is latest before you use
[{
"areaName": "台北地區",
"stations": [{
"stationId": "1810",
"stationName": "福隆"
}, {
"stationId": "1809",
function draeEverything(){
console.log(ballx);
canvasContext.fillStyle = 'black';
canvasContext.fillRect(0,0,canvas.width,canvas.height);
canvasContext.fillStyle = 'while';
canvasContext.beginPath();
canvasContext.arc(ballx,bally,10,0,Math.PI*2,true);
canvasContext.fill();
}
[self inTransaction:^(FMDatabase *db, BOOL *rollback) {
for (NSDictionary *dictionary in array) {
count += 1;
[db executeUpdate:@"INSERT INTO actors (name,aid) VALUES (?,?)", [dictionary objectForKey:@"name"], [NSNumber numberWithInteger:[[dictionary objectForKey:@"id"] integerValue]]];
}
}];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
self.adView = [[MPAdView alloc] initWithAdUnitId:@"62a209a4f9764ffcb711b7fac2010d16" size:CGSizeMake(1024, 90)];
self.adView.delegate = self;
self.adView.frame = CGRectMake(0, 0, 1024, 90);
[self.adView loadAd];
[self.view addSubview:self.adView];
@JohnnyTseng
JohnnyTseng / gist:6293fc7c222dc9a4af91
Last active August 29, 2015 14:09
Change Line notification sound to Skype notification sound
sudo mv /Applications/LINE.app/Contents/Resources/sounds/Bell.wav /Applications/LINE.app/Contents/Resources/sounds/backup.wav
sudo cp /Applications/Skype.app/Contents/Resources/Sounds/Message\ Received\ .m4a /Applications/LINE.app/Contents/Resources/sounds/Bell.wav