Skip to content

Instantly share code, notes, and snippets.

@yllan
yllan / 0.3.22
Created August 20, 2014 04:00
Update Detail
- 讓 user 可自定網址
- 個人報告可查看評價
- 訂單資訊
* 更新 icon(橘色 → 灰色)
* 顯示買家評價
* style
- 拍照可以裁切
- 加大拍照的「使用」按鈕,比較好按到
- 照片可選擇 album
- Settings 加入 logout 按鈕
@yllan
yllan / fetch.swift
Last active August 29, 2015 14:02
Perfume LOCKS fetcher script in swift
import Cocoa
var quotations: Dictionary<String, String[]> = Dictionary()
for page in 1...76 {
println("page \(page)")
let url = NSURL(string: "http://www.tfm.co.jp/lock/perfume/index.php?catid=23&page=\(page)")
let data = NSData(contentsOfURL: url)
let htmlOpt: NSString? = NSString(data: data, encoding: NSJapaneseEUCStringEncoding)
@yllan
yllan / t.swift
Created June 6, 2014 02:53
Encoding problem
import Cocoa
let url = NSURL(string: "http://www.tfm.co.jp/lock/perfume/index.php?catid=23&page=2")
let data = NSData(contentsOfURL: url)
let html = NSString(data: data, encoding: NSJapaneseEUCStringEncoding)
html.rangeOfString("あ~ちゃん") // 從 safari 把 pattern 貼上
@yllan
yllan / scroll.m
Created May 15, 2014 06:28
Scroll to top gently
void scrollGently(UIScrollView *scrollView, CGFloat scrollToTop)
{
CGFloat paddingSpace = 10; // 留一點空隙
// 應該要捲到的位置
CGFloat targetY = scrollToTop - scrollView.contentInset.top - paddingSpace;
// 捲到最下面的位置
CGFloat maxYOffset = scrollView.contentSize.height + scrollView.contentInset.bottom - scrollView.bounds.size.height;
:m + Data.Numbers.Primes
let digitSum n = sum $ map (\x -> read [x]::Integer) $ show n
let digitRoot x | x < 10 = x | otherwise = digitRoot $ digitSum x
let holesIn (x:y:xs) | y == x + 1 = holesIn (y:xs) | otherwise = [x+1..y-1] ++ holesIn (y:xs)
let p = primes
let c = (holesIn primes)::Int
@yllan
yllan / hosts
Created April 11, 2014 11:06
旺中守門員(自力救濟加到 /etc/hosts )
127.0.0.1 chinatimes.com
127.0.0.1 www.chinatimes.com
127.0.0.1 video.chinatimes.com
127.0.0.1 mag.chinatimes.com
127.0.0.1 showbiz.chinatimes.com
127.0.0.1 life.chinatimes.com
127.0.0.1 money.chinatimes.com
127.0.0.1 m.chinatimes.com
127.0.0.1 www.ctitv.com.tw
String[196.81001,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.228546]政
String[214.03836,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=16.239594]治
String[230.27776,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=18.1828]獻
String[248.46036,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.540863]金
String[266.001,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.089752]會
String[283.09055,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.12445]計
String[300.21478,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.679657]報
String[317.89423,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.402039]告
String[335.29608,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.228546]書
String[352.52444,34.54004 fs=17.35 xscale=17.35 height=14.695452 space=4.3375 width=17.211212]查
Analyzing dependencies
/usr/local/Cellar/ruby/2.0.0-p353/lib/ruby/gems/2.0.0/gems/xcodeproj-0.14.1/ext/xcodeproj/xcodeproj_ext.bundle: [BUG] Segmentation fault
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.2]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.concurrent._
import scala.concurrent._
scala> import scala.concurrent.duration._
import scala.concurrent.duration._
@yllan
yllan / PerfumeHangout.md
Created October 6, 2013 14:27
Perfume Google+ Hangout 見面會心得

Perfume 視訊見面會

(警告,其實沒什麼內容,大部份是我無聊的內心戲,因為日文聽不懂)

我自認不算迷弟,不過抽中 Perfume 視訊會還是有點小鹿亂撞!這感覺,好像和當年想約喜歡的女生去看蘋果電腦展一樣,準備一堆計劃,打電話前還畫樹狀圖模擬各種對話(結果第一句就被拒絕)。

十五年後,我已不是當年的青澀少年了。我當然知道 Google+ Hangout 要塞二十個人是怎樣的畫質;我當然知道不會日文的我最適合默默當背景;我當然知道沒有很用心追星的我在 Perfume 眼中和路人一樣過目即忘。我告訴那個十五年前一頭熱忙著準備的自己,省省吧!你只是個屁而已!

「原來還沒開始就放棄,這就是大人啊。」只好這麼調侃自己。沒有期望就沒有失望嘛。