Skip to content

Instantly share code, notes, and snippets.

View mr-kelly's full-sized avatar
🤔
Born for Future

Kelly Peilin Chan mr-kelly

🤔
Born for Future
View GitHub Profile
@DarrenN
DarrenN / get-npm-package-version
Last active April 17, 2024 16:57 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@shuax
shuax / decorator
Created July 2, 2014 06:07
lua decorator,类似python那样的装饰器
local function decorator(str)
local rebuild_str = {}
local rebuild_fun = "(\0)"
local state = 0
for line in str:gmatch('[^\r\n]+') do
if line:find("@") then
rebuild_fun = string.format("(%s"..rebuild_fun..")", line:sub(2))
state = 1
else
if state==0 or state==3 then
@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@onlytiancai
onlytiancai / wawammseg.py
Created June 30, 2012 08:44
写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码
# -*- coding:utf-8 -*-
'写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码'
'搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5'
import string
__dict = {}
def load_dict(dict_file='words.dic'):
'加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典'