Skip to content

Instantly share code, notes, and snippets.

View tjwudi's full-sized avatar

Di Wu tjwudi

View GitHub Profile

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

class CreateLikes < ActiveRecord::Migration
def change
create_table :likes do |t|
t.references :user, index: true
t.references :activity, index: true
t.timestamps
end
end
end
@tjwudi
tjwudi / enable_ie_html5.js
Created September 11, 2013 09:37
Enable html5 tags for Internet Explorer (< 9)
<!--if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@tjwudi
tjwudi / gist:6284324
Created August 20, 2013 17:12
gbtag试用想法
www.gbtags.com试用的一些想法
觉得理念挺好的,是一个专门属于前端的community。好的地方就不多说了吧,我就提存在的一些问题、以及个人建议:
1、文章发布、评论没有提供markdown的编辑器
2、许多页面加载以及滚动的时候均存在比较严重的延迟,甚至卡死,http://www.gbtags.com/gb/rtcollabration/2933.htm页面完全无法加载(chrome挂了)。建议:
(1)取消部分animation,比如http://www.gbtags.com/gb/explore.htm和http://www.gbtags.com/gb/users.htm载入的时候由于<article>部分的animation过多,会造成很严重的延迟
(2)就http://www.gbtags.com/gb/explore.htm来看,页面脚本占了生成代码将近1/2的分量,没有经过uglify压缩。建议压缩脚本
3、标签没有搜索功能?
4、比较细节的一些地方:功能和设计其实很够用,很丰富,但是总觉得有些冗余。比如http://www.gbtags.com/gb/explore.htm中,比如我选择了以文本方式阅读,结果出来的就只是标题和“阅读全文”。这只是其中一个例子吧,我在设计上不是太符合一致性设计的原则,感觉稍乱了。
以上的测试是在Chrome 29.0.1534.0和Firefox 23下面简单地测试了一下。
@tjwudi
tjwudi / vim-bullet-points.md
Last active November 23, 2015 07:00
Vim Bullet Points

Command Mode

  • 'a' - append after the cursor
  • 'A' - append at the end of current line

Commands

  • :vimgrep can help you to search through multiple files. It also tells you where you are now in the search. You can use :copen to see all matches.
  • :vnew Open an empty buffer as a vertical split
  • :%s/old/new/gc Replace all old with new throughout file with confirmations
@tjwudi
tjwudi / gist:3d1f98981e52a387015b
Created November 22, 2015 22:54
runtime-error.txt
++ timestamp
+++ date +%s.%N
++ echo 1448231881.012023753
+ scriptstarttime=1448231881.012023753
+ readonly INTERNAL_ERROR_CODE=123
+ INTERNAL_ERROR_CODE=123
+ exist_file_or_die /mnt/prog_joined.js
+ local file=/mnt/prog_joined.js
+ '[' '!' -f /mnt/prog_joined.js ']'
+ exist_file_or_die /mnt/data.in
@tjwudi
tjwudi / main.yml
Created October 14, 2015 05:13 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
echo 1
[alias]
s = status
co = checkout
p = push
c = commit
a = add
aa = add -A
ap = add -p
@tjwudi
tjwudi / README.md
Last active August 29, 2015 14:21 — forked from mbostock/.block