Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kcchien's full-sized avatar

Kuang-Cheng Chien kcchien

  • King Steel Machinery Co., Ltd.
  • Taichung, Taiwan
View GitHub Profile
@kcchien
kcchien / 0_reuse_code.js
Created February 21, 2017 13:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kcchien
kcchien / iterm2-solarized.md
Created June 2, 2017 12:01 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@kcchien
kcchien / config.fish
Last active June 4, 2017 06:55
Install fish shell
# Copy this file to ~/.config/fish/
function fish_prompt
~/powerline-shell/powerline-shell.py $status --shell bare ^/dev/null
end
@kcchien
kcchien / npm-exec.bat
Created June 5, 2017 08:43 — forked from joeyespo/npm-exec.bat
Execute a node_modules/.bin script on Windows.
@ECHO OFF
SETLOCAL
REM Speed up by checking for bin directory directly
IF NOT EXIST node_modules\.bin GOTO FINDBIN
SET BIN=.\node_modules\.bin
GOTO RUN
:FINDBIN
REM Find the current bin directory from npm, storing the result in 'BIN'
@kcchien
kcchien / difference.js
Created June 28, 2018 07:28 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@kcchien
kcchien / cpm.js
Created August 4, 2018 06:17 — forked from perico/cpm.js
Critical Path Method Implementation Javascript
/**
* Implementation of the Critical Path Method (CPM) with variation
* @see http://en.wikipedia.org/wiki/Critical_path_method
*
* Shows all the critical Paths, returns a subset of the graph
* containing the critical activities
*/
/**
* Activity Class
@kcchien
kcchien / parseMustache.coffee
Created August 10, 2018 07:52 — forked from lucasmotta/parseMustache.coffee
A simple function to parse strings with {{mustache}} tags and replace its dot notation string to a given object path.
parseMustache = (str, obj) ->
str.replace /{{\s*([\w\.]+)\s*}}/g, (tag, match) ->
nodes = match.split(".")
current = obj
for node in nodes
try
current = current[node]
catch
return ""
current
// Config file
import * as firebase from "firebase";
const config = {...};
export default !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
// Other file
import firebase from '../firebase';
...
@kcchien
kcchien / getEnviroments1.vbs
Last active October 3, 2018 06:48
VBA 取得電腦名稱及使用者名稱
' Way 1: Though environment variables
Dim sHostName As String
Dim sUserName As String
' Get Host Name / Get Computer Name
sHostName = Environ$("computername")
' Get Current User Name
sUserName = Environ$("username")
@kcchien
kcchien / ignore100M.sh
Last active October 5, 2018 08:34
.gitignore 排除大於100MB以上的檔案
find . -size +100M | cat >> .gitignore
find . -size +1G | sed 's|^\./||g' | cat >> .gitignore; awk '!NF || !seen[$0]++' .gitignore