Skip to content

Instantly share code, notes, and snippets.

View FrankWu100's full-sized avatar

Frank Wu FrankWu100

View GitHub Profile
@FrankWu100
FrankWu100 / UIColorFromRGB.m
Last active February 26, 2016 11:50
UIColor macro with hex values
// http://stackoverflow.com/a/3532264
// http://cocoamatic.blogspot.tw/2010/07/uicolor-macro-with-hex-values.html
// http://www.touch-code-magazine.com/web-color-to-uicolor-convertor/
//RGB color macro
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@FrankWu100
FrankWu100 / PCCUYYM.cs
Last active August 29, 2015 14:00
PCCU YYM C#
using System;
using System.Globalization;
namespace CoreLib
{
public class PCCUYYM
{
string _YYM = "";
public static PCCUYYM Now {
- (NSString *)analysisTitle:(NSString *)theDate
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
//[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
//yyyy-MM-dd HH:mm:ss
NSDate *date = [NSDate date];
date = [formatter dateFromString:theDate];
// NSLog(@"Date:%@", [formatter stringFromDate:date]);
#include <iostream>
#include <sstream>
using namespace std;
string itos(int n)
{
stringstream ss;
ss << n;
return ss.str();
@FrankWu100
FrankWu100 / .gitignore
Last active August 29, 2015 14:07 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.3
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
tell application "System Events"
if button "結束" of window 1 of application process "FaceTime" exists then
click button "結束" of window 1 of application process "FaceTime"
end if
end tell
try
do shell script "killall FaceTime"
end try
@FrankWu100
FrankWu100 / 自動撥打暴雪安全鎖+啟動Battle.net.scpt
Created October 9, 2015 14:41
自動用 Handoff 撥打暴雪安全鎖, 成功後再自動啟動 Battle.net
tell application "System Events"
if button "結束" of window 1 of application process "FaceTime" exists then
click button "結束" of window 1 of application process "FaceTime"
end if
end tell
try
do shell script "killall FaceTime"
end try
using System;
class Untitled
{
static void Main(string[] args)
{
int _count = 15;
int countA = 0, countB= 0;
bool win = false;
bool needReInput = false;
@FrankWu100
FrankWu100 / getWindDirection.cs
Last active February 25, 2016 16:21
將角度(0~360)換算為東西南北表示
public string convertWindDirection(double directionAngle, int precision)
{
if (precision != 4 && precision != 8 && precision != 16 && precision != 32)
return "\"precision\"準確度設定錯誤, 須為 4 or 8 or 16 or 32.";
string[] windDirectionName = new string[32] { "北", "北微東", "北北東", "東北微北", "東北", "東北微東", "東北東", "東微北",
"東", "東微南", "東南東", "東南微東", "東南", "東南微南", "南南東", "南微東",
"南", "南微西", "南南西", "西南微南", "西南", "西南微西", "西南西", "西微南",
"西", "西微北", "西北西", "西北微西", "西北", "西北微北", "北北西", "北微西" };
@FrankWu100
FrankWu100 / private.xml
Last active June 25, 2016 11:47
Karabiner Custom Setting
<?xml version="1.0"?>
<root>
<item>
<name>-- Private Custom Setting --</name>
<item>
<name>Use PC Style Home/End #3</name>
<appendix>Change Home to Command+Up-Arrow</appendix>
<appendix>Change End to Command+Down-Arrow</appendix>
<identifier>private.HomeEnd_to_CommandUpDownArrow</identifier>
<autogen>__KeyToKey__ FROMKEYCODE_HOME, KeyCode::CURSOR_UP, ModifierFlag::COMMAND_L</autogen>