-->

Neater

Be A Warrior, Not A Worrier

用Ruby写Alfred2的Workflow

Mac下的大杀器Alfred2用了好久,Workflow也收集了不少,那为什么不自己写一个呢?当添加一个Workflow时发现,竟然支持这么多的语言,那就用我的最爱Ruby开工吧!

view frame

第一次就拿ASCII码转换练练手吧,可以将十进制ASCII码转换成字符

还可以将16进制ASCII转换成字符

或者把字符转换成ASCII码

这里使用了alfred2-ruby-template模板,使用过程如下

1
2
3
$ git clone https://github.com/zhaocai/alfred2-ruby-template.git
$ mv alfred2-ruby-template alfred2-ascii-translator
$ cd alfred2-ascii-translator

更新config.yml的domain, id, path字段:

1
2
3
4
5
6
7
8
9
# bundle_id = "domain.id"
# path is the relative path to the workflow in the project root
---
path: ascii
domain: me.ytliu
id: alfred2-ascii-translator
# If you are using Alfred's advanced Dropbox sync, indicate the path shown in
# Alfred Preferences > Advanced > Syncing:
dropbox: ~/Dropbox/Alfred