Skip to content

Instantly share code, notes, and snippets.

View lzhoucs's full-sized avatar
🏠
Working from home

Liang Zhou lzhoucs

🏠
Working from home
View GitHub Profile
@lzhoucs
lzhoucs / homebrew.org
Last active January 15, 2017 21:17
Homebrew Reference

Homebrew contribution

Update brew formula

Update brew cask

Use cask-repair to update the cask, commit the change, push and create the PR automatically.

Prerequisite

  • Go to $(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks directory
  • github user remote is set to origin, upstream remote is set to upstream. And both remotes are up to date

Steps

  • cask-repair '<cask_name>'. E.g: cask-repair 'karabiner-elements'
  • specify new version
@lzhoucs
lzhoucs / node-debug.org
Last active May 30, 2017 16:47
node debug with built in v8 inspector

Debug grunt tasks

node --inspect --debug-brk $(which grunt) <TaskName>

Debug intern node tests

replace client with runner, intern with intern-local for functional tests

node --inspect --debug-brk node_modules/intern/client config=_build/tests/intern

Dojo2 example:


@lzhoucs
lzhoucs / idea-reset-evaluation.sh
Last active February 28, 2023 19:19
reset intellij idea 14 evaluation
#!/bin/bash
echo "removing evaluation key"
rm ~/.IntelliJIdea15/config/eval/idea15.evaluation.key
# for mac go to: /Users/username/Library/Preferences/IntelliJIdea2016.3/eval/idea163.evaluation.key
echo "resetting evalsprt in options.xml"
sed -i '/evlsprt/d' ~/.IntelliJIdea15/config/options/options.xml
# for mac go to: /Users/lzhoucs/Library/Preferences/IntelliJIdea2016.3/options/options.xml
@lzhoucs
lzhoucs / readme.md
Last active June 26, 2016 01:08
linux packages check list for web development
  1. nvm & node
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
nvm install v6  // assume this is done: source "$NVM_DIR/nvm.sh" 
  1. rvm & ruby
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@lzhoucs
lzhoucs / readme.md
Last active June 25, 2016 21:19
build latest zsh from source
@lzhoucs
lzhoucs / build-emacs.md
Last active October 23, 2016 01:19
build emacs from github repo or source package

Install

  1. uncomment deb-src
sudo vi /etc/apt/sources.list
  1. update
sudo apt-get update
@lzhoucs
lzhoucs / c#.md
Last active November 13, 2015 23:20
The beauty of c# compared to java
  • Access modifier

protected internal can block any third party code outside of the assembly from subclassing/overriding methods inside the assembly.

  • equals

Object.ReferenceEquals() can check reference equality when hashcode()/equals() have been overriden to compare object equality between two objects. In java we can only check either object equality or reference equality, but not both.

  • package/code organization
@lzhoucs
lzhoucs / bit-manipulation-tricks.md
Last active November 6, 2015 06:55
bit manipulation tricks
  • drop the first bit
x >> 1;
  • drop LSB (the least Significant bit)
x & (x - 1);
  • extracts the lowest set bit of x (all other bits are cleared)
@lzhoucs
lzhoucs / scope1.md
Last active August 29, 2015 14:25
javascript variable scope demo

In the following example:

  • i is defined; j is undefined but declared; k is undeclared thus causing error;
  • indx is hoisted to the top of the function.
(function () {
  var i = 1;
  var j;
  console.log("i : " + i); // i : 1
  console.log("j : " + j); // j : undefined
 //console.log("k : " + k);// ReferenceError: k is not defined
@lzhoucs
lzhoucs / emacs.org
Last active September 28, 2016 18:24
emacs useful commands

emacs

cursor-moving

C-f Move forward a character C-b Move backward a character

M-f Move forward a word M-b Move backward a word

C-n Move to next line C-p Move to previous line