Skip to content

Instantly share code, notes, and snippets.

@adong
adong / zshrc_file
Last active December 8, 2018 04:54
zshrc
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@adong
adong / Load_JS_Snippets.js
Created October 9, 2018 21:17
Load external javascript lib from dev tool
(function() {
var u = 'http://example.com/bookmarklet.js';
u = 'https://cdn.jsdelivr.net/npm/[email protected]/build/circular-json.node.min.js';
var s = document.createElement('script');
s.type = 'text/javascript';
s.charset = 'utf-8';
s.src = u;
document.body.appendChild(s);
})()
@adong
adong / memoize_function.js
Created October 23, 2018 18:03
Memoize function
function memoize(func) {
var memo = {};
var slice = Array.prototype.slice;
return function() {
var args = slice.call(arguments); // what if func(1,2,3) needs to be treated as the same as func(2,3,1)
if (args in memo) {
@adong
adong / javascript_closure.js
Last active April 5, 2024 16:55
javascript closure trap
// What is the result of the following?
for (var i=0; i<10; ++i) {
setTimeout(function() {
console.log(i);
}, 1000);
}
// using IIFE (immediately invoked function)
// with delay
" ==============================================================================
" Author: Alan Dong
" Version: 0.3.4
" README: TODO
" Last Modified Date: 12/07/2018
" Description: My Vim Configuration file
" ==============================================================================
" set shell for bash as default
set shell=/bin/bash
" ==============================================================================
" Author: Alan Dong
" Version: 0.3.5
" Last Modified Date: 8/17/2018
" Description: My Vim Configuration file for Server
" ==============================================================================
" set shell for bash as default
set shell=/bin/bash
@adong
adong / controllers.application.js
Created December 18, 2018 23:37 — forked from alexdiliberto/controllers.application.js
Ember's Route Hook Order with Application Controller Init
import Ember from 'ember';
function logHook(property) {
return function() {
let log = `<span class="log-item log-hook-item">${this._debugContainerKey} - ${property}</span>`;
Ember.$('body').append(log);
return this._super(...arguments);
};
};
export default Ember.Controller.extend({
@adong
adong / tmux.conf.md
Created May 1, 2019 19:58
Tmux Config

This Version is for tmux 2.0

set-option -g default-command "reattach-to-user-namespace -l zsh"

# -- set the mouse gesture on --#
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
@adong
adong / tmux.conf_2.9.md
Created May 1, 2019 19:59
Tmux Config 2.9

This Version is for tmux 2.9

# Update config from tmux 2.9
# Issue: https://gitlab.com/fernandobasso/dotfiles/commit/af2c0ac59b93b318575367f0313ad1ca0627a6ba
# Migration: https://gist.github.com/tbutts/6abf7fb5b948c066bf180922fb37adcf

set-option -g default-command "reattach-to-user-namespace -l zsh"

# -- set the mouse gesture on --#
#set -g mode-mouse on
@adong
adong / set-multi-github-accounts.md
Created November 11, 2019 05:33
set git account rather than default

Setting up github ssh

git clone your-git-repo

After ssh-keygen and add to your github

Host github_adong
    Hostname github.com
 User git