Skip to content

Instantly share code, notes, and snippets.

@yycking
yycking / ELECOMMOUSE.xml
Created September 12, 2018 10:18
fix safari:forward/back not work on ELECOM mouse assistant
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data>
<vid>1390</vid>
<pid>249</pid>
<select_profile>0</select_profile>
<profile>
<profname>default</profname>
<lbutton>1</lbutton>
<rbutton>2</rbutton>
<tbutton>5</tbutton>
@yycking
yycking / README.md
Last active November 5, 2020 03:12
RIME自訂

clone files to ~/Library/Rime

@yycking
yycking / test.pl
Created July 21, 2018 04:04
test for prolog
% Prolog寫起來,真的很愉悅
%事實
母(毛福梅, 蔣經國).
母(蔣方良, 蔣孝文).
母(蔣方良, 蔣孝武).
父(蔣介石, 蔣經國).
父(蔣經國, 蔣孝文).
父(蔣經國, 蔣孝武).
父(蔣經國, 章孝嚴).
@yycking
yycking / swipl.pl
Created July 21, 2018 03:51
SWIProlog on TextMate
#!/usr/bin/env ruby18
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document"
TextMate.save_current_document
TextMate::Executor.make_project_master_current_document
command = ["swipl", "-f", "#{ENV["TM_FILEPATH"]}", "-t", "main", "-g", "true", "--quit"]
TextMate::Executor.run(command)
@yycking
yycking / 自然語言處理.swift
Created May 15, 2018 07:35
自然語言處理 NSLinguisticTagger
語言辨識:zh-Hant
斷詞:["戚戚", "堆積", "到", "淒慘", "得", "急", "憔悴", "冷冷清清", "傷心", "這", "也", "點點滴滴", "將息", "杯", "淡", "時候", "摘", "慘", "黃", "酒", "獨自", "最", "他", "有", "淒", "怎", "正", "梧桐", "難", "更", "字", "窗兒", "守", "風", "是", "如今", "兩", "乍暖還寒", "盞", "次第", "個", "尋尋覓覓", "堪", "舊時", "過", "愁", "怎生", "了得", "敵", "來", "相識", "花", "誰", "雁", "著", "黑", "卻", "晚", "黃昏", "細雨", "三", "滿地", "兼", "一", "損"]
詞性標記
詞形還原
具名實體辨識
語言辨識:en
斷詞:["no", "I", "my", "\'ll", "wilt", "Capulet", "thou", "not", "if", "be", "and", "but", "Romeo", "love", "name", "thy", "wherefore", "longer", "O", "art", "a", "And", "father", "Deny", "Or", "sworn", "refuse"]
詞性標記
no:Adverb
I:Pronoun
@yycking
yycking / ShellCommand.sublime-commands
Last active June 19, 2018 10:42
[Option+Shift+K] for react native on Sublime Text
[
{
"caption": " 📱",
"command": "shell_command",
"args": {
"command": "open -a '/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app'",
}
},
{
"caption": " 🏭📱",
@yycking
yycking / UIActivityViewController∓Facebook.swift
Last active April 10, 2018 06:29
FB no longer allows pre-fill.
extension NSString:UIActivityItemSource {
public func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any {
return ""
}
public func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType) -> Any? {
let installedFB = UIApplication.shared.canOpenURL(URL(string: "fb://")!)
let isFB = activityType == UIActivityType.postToFacebook
if installedFB && isFB {
return nil
@yycking
yycking / carousel.js
Last active April 25, 2018 10:29
Carousel in React Native
@yycking
yycking / Redux特調.js
Created March 19, 2018 03:27
Redux特調
// store: 一個app state的集合體,以object表示
// 換句話說,store是由許多state組成
// 先規劃 store,初始值如下
// {
// 原料: ["咖啡"],
// 顏色: {
// 紅: 111,
// 綠: 78,
// 藍: 55,
// }
@yycking
yycking / text2bitmap.swift
Created December 25, 2017 11:26
String to [[Bool]]
import Foundation
import Cocoa
func text2bitmap(text: String, font: NSFont) -> [[Bool]]? {
let attributes = [NSAttributedStringKey.font:font]
let size = text.size(withAttributes: attributes)
let width = Int(size.width)
let height = Int(size.height)
let bytesPerRow = width