Skip to content

Instantly share code, notes, and snippets.

View zhaiduo's full-sized avatar
💭
hello world

Adam zhaiduo

💭
hello world
View GitHub Profile
@zhaiduo
zhaiduo / https.js
Created March 26, 2012 16:55
nodejs https
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('./nodejs.pem'),
cert: fs.readFileSync('./nodejs.crt')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
@zhaiduo
zhaiduo / gist:21e8e35502e770f193a4
Last active September 9, 2015 14:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@zhaiduo
zhaiduo / uploads
Created March 9, 2016 17:10
uploads
http://www.html5rocks.com/en/tutorials/file/dndfiles/
@zhaiduo
zhaiduo / gist:bd3037b58cef733ef2b1
Created March 9, 2016 17:12 — forked from hiddentao/gist:7300694
An improvement on the angular.module() API, making it easier to split up modules into multiple files without having to worry about only registering them once.
/**
* Workaround to make defining and retrieving angular modules easier and more intuitive.
*/
(function(angular) {
var origMethod = angular.module;
var alreadyRegistered = {};
/**
#!/usr/bin/env python
#
# 1. Save this file as `pre-commit` in your local .git/hooks/ directory
# 2. Make sure your file is executable `chmod +x pre-commit`
# Upon git commit, this script will check your staged files against your eslint ruleset
# More flags and options at http://eslint.org/
import os, sys
"""
@zhaiduo
zhaiduo / 如何定制不同id_rsa到github
Last active October 10, 2016 08:07
如何定制不同id_rsa到github
ssh-keygen -t rsa -C "xxx@me.com"
cat /home/deploy/.ssh/id_rsa_xxx.pub, copy to github
edit ~/.ssh/config
```
# XXX
Host github-xxx
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_xxx
```
@zhaiduo
zhaiduo / tmux-cheatsheet.markdown
Created July 26, 2016 14:47 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@zhaiduo
zhaiduo / README.md
Created September 14, 2016 07:22 — forked from rowanmanning/README.md
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/
@zhaiduo
zhaiduo / karma.conf.js
Created October 11, 2016 09:37
ES6 + Babel + Browserify + Mocha + Chai + Karma + Istanbul + PhantomJS
var istanbul = require('browserify-istanbul');
module.exports = function (config) {
config.set({
basePath: '../',
files: ['src/scripts/**/*.js', 'test/unit/**/*.js'],
frameworks: ['browserify', 'mocha', 'chai'],
browsers: ['PhantomJS'], // 'Chrome'
@zhaiduo
zhaiduo / Is git status gone after upgrade Oh My Zsh?
Created October 18, 2016 14:48
Is git status gone after upgrade Oh My Zsh?
Solution:
1. cd ~/.oh-my-zsh/
2. sudo git status
3. you will see "Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'"
4. click space key till "agree" enter