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 / 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 / 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 / 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 / Default.sublime-theme
Created March 16, 2017 05:33 — forked from MrDrews/Default.sublime-theme
Solarized (light) -- Complement the stock Solarized (light) theme in sublime text 3 by placing this `Default.sublime-theme` inside the `Packages/User` folder. It will recolor the sidebar.
[
{
"class": "sidebar_container",
// $base02: #073642
"layer0.tint": [7,54,66],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
@zhaiduo
zhaiduo / autopair-underscores-backticks.json
Created April 24, 2017 10:29 — forked from ckunte/autopair-underscores-backticks.json
Autopair underscores and backticks in Sublime Text (2) -- for Markdown editing. Save the following under Preferences → Key Bindings - User
[ // Auto-pair underscores
{ "keys": ["_"], "command": "insert_snippet", "args": {"contents": "_$0_"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[_a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.underscore", "match_all": true }
]
},
@zhaiduo
zhaiduo / proxies-es5.js
Created August 10, 2017 06:07 — forked from rauschma/proxies-es5.js
ES6 proxies in ES5
//----- The ECMAScript 6 meta object protocol (MOP) implemented in ES5
// This is how getting a property is handled internally.
// Double underscore (__) implies internal operation.
Object.prototype.__Get__ = function (propKey, receiver) {
receiver = receiver || this;
var desc = this.__GetOwnProperty__(propKey);
if (desc === undefined) {
var parent = this.__GetPrototypeOf__();
if (parent === null) return undefined;
@zhaiduo
zhaiduo / .eslintrc.js
Created April 10, 2018 03:20 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {