Skip to content

Instantly share code, notes, and snippets.

View XGHeaven's full-sized avatar
🐟
Finding web future

Bradley Xu XGHeaven

🐟
Finding web future
View GitHub Profile
@XGHeaven
XGHeaven / style_guide.md
Created November 7, 2015 01:54 — forked from dominictarr/style_guide.md
style guide

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@XGHeaven
XGHeaven / uncarryThis.js
Created February 1, 2016 04:59
JavaScript Magic Technology
/**
* call wrapper function is equal to use call/apply to invoke function
* see follow usage
*
* @param {Function} f - need to wrapper function
*/
var uncurryThis = function(f) {
var call = Function.call;
return function() {
return call.apply(f, arguments);
@XGHeaven
XGHeaven / iStat Menus Setting.ismp
Last active July 3, 2019 14:15
iStat Menus Setting
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>build</key>
<real>630</real>
<key>license</key>
<string>1574-5977-7956-8062-0000</string>
<key>preferences</key>
<dict>
@XGHeaven
XGHeaven / .cvimrc
Created April 29, 2016 06:51
cVimrc
let searchengine baidu = "https://www.baidu.com/s?wd=%s"
command g tabnew google
command b tabnew baidu
let barposition = "bottom"
set cncpcompletion
let blacklists = ["https://github.com/*", "https?://localhost:*/*", "chrome://newtab/*", "https?://inbox.google.com/*", "https?://mail.google.com/*", "https?://cnode.xgheaven.cn/*"]
@XGHeaven
XGHeaven / .gitignore
Created May 1, 2016 09:48
thinkphp relative files
Runtime
Uploads
Data
.DS_Store
abbr -a g 'git'
abbr -a ga 'git add'
abbr -a gaa 'git add --all'
abbr -a gapa 'git add --patch'
abbr -a gb 'git branch'
abbr -a gba 'git branch -a'
abbr -a gbda 'git branch --merged | command grep -vE "^(\*|\s*master\s*\$)" | command xargs -n 1 git branch -d'
abbr -a gbl 'git blame -b -w'
abbr -a gbnm 'git branch --no-merged'
abbr -a gbr 'git branch --remote'
@XGHeaven
XGHeaven / cnpm.fish
Created March 18, 2017 18:39
cnpm fish completion
# cnpm (https://cnpmjs.org) completions for Fish shell
# __fish_cnpm_needs_* and __fish_cnpm_using_* taken from:
# https://stackoverflow.com/questions/16657803/creating-autocomplete-script-with-sub-commands
# see also Fish's large set of completions for examples:
# edited based on https://github.com/fish-shell/fish-shell/tree/master/share/completions
function __fish_cnpm_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
@XGHeaven
XGHeaven / README.md
Created March 22, 2017 10:24
Install PHP7 on OS X El Capitan

Install PHP7 on OS X El Capitan

add the taps, unlink the old PHP if required and add php7

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56
brew install php70
@XGHeaven
XGHeaven / index.js
Created April 23, 2017 18:12 — forked from sperand-io/index.js
Koa EventSource Streaming (SSE)
const PassThrough = require('stream').PassThrough;
const Router = require('koa-66');
const router = new Router();
const Koa = require('koa');
const app = new Koa();
// ...
router.get(`/json/data/:source`, ctx => {
const stream = new PassThrough();
@XGHeaven
XGHeaven / centos-base.sh
Created January 18, 2018 03:36
server-init-script
# install base command
yum install zsh vim git curl -y
# install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# install ivim
bash <(curl -L https://raw.githubusercontent.com/kepbod/ivim/master/setup.sh) -m