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 / php.apache.config.2016.10.org
Last active October 22, 2016 22:27
PHP Apache Configuration on Windows 7
@lzhoucs
lzhoucs / 00.nodejs programs
Last active August 29, 2015 14:05
Simple tools and programs written in Node.js
title file
@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

@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 / 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 / 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 / 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 / readme.md
Last active June 25, 2016 21:19
build latest zsh from source
@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 / 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