Skip to content

Instantly share code, notes, and snippets.

View mingliangguo's full-sized avatar

Mingliang mingliangguo

View GitHub Profile
@mingliangguo
mingliangguo / git_branch_parent.sh
Last active October 20, 2016 00:33 — forked from intel352/git_branch_parent.sh
get the parent of the current branch
#!/usr/bin/env zsh
branch=`git rev-parse --abbrev-ref HEAD`
git show-branch | ack '\*' | ack -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# How it works:
# 1| Display a textual history of all commits.
# 2| Ancestors of the current commit are indicated
# by a star. Filter out everything else.
@mingliangguo
mingliangguo / 0_reuse_code.js
Created October 18, 2016 13:53
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
@mingliangguo
mingliangguo / tmux.conf
Created November 23, 2016 17:47 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@mingliangguo
mingliangguo / osx-setup.md
Created December 26, 2016 03:44 — forked from zenorocha/.hyper.js
Setup macOS Sierra (10.12)

Setup macOS

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an AirPort Time Capsule that backs up everything using Time Machine, but I don't want all the crap I had in the old one. So let's get our hands dirty!

1. Update OS to latest version

@mingliangguo
mingliangguo / maven-war-exclude-directory.md
Created January 12, 2017 03:00 — forked from baybatu/maven-war-exclude-directory.md
Excluding Directory From War Package In maven-war-plugin

packagingExcludes configuration tag can be used to exclude certain files or directories from the war file. It is important to put '/' character at the end of the directory to be excluded. If there is no such '/' character, then the entry is interpreted as a regular file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
 
@mingliangguo
mingliangguo / pre-commit
Created January 24, 2017 15:40 — forked from mebibou/pre-commit
JSHint and JSCS pre-commit hook
#!/bin/sh
# pre-commit git hook.
files=$(git diff --cached --name-only --diff-filter=ACMR -- \*.js **/*.js)
pass=true
if [ "$files" != "" ]; then
for file in ${files}; do
@mingliangguo
mingliangguo / disable_SSL_and_hostname_verification.java
Last active March 14, 2025 07:38
disable SSL and host name verification for apache httpclient
try {
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) { }
public void checkServerTrusted(X509Certificate[] certs, String authType) { }
}
@mingliangguo
mingliangguo / gradle recipe
Last active February 16, 2017 17:34
gradle recipe
# You can tell Gradle to re-download some dependencies in the build script by flagging the dependency as 'changing'. Gradle will then check for updates every 24 hours, but this can be configured using the resolutionStrategy DSL. I find it useful to use this for for SNAPSHOT or NIGHTLY builds.
# refer to [link](http://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies)
# https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
@mingliangguo
mingliangguo / emoji.js
Created April 2, 2018 03:04
emoji converter
// convert emoji character to unicode key sequences
var getCode = emoji => emoji.split('').map(c => c.codePointAt(0).toString(16)).join('-');
var unifiedToEmoji = unified => {
return unified
.split('-')
.map(hex => parseInt(hex, 16))
.map(hex => String.fromCodePoint(hex))
.join('');
};