Skip to content

Instantly share code, notes, and snippets.

View mingliangguo's full-sized avatar

Mingliang mingliangguo

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / use blob to read thumbnail content
Created August 3, 2016 02:45
An even simpler version to get box thumbnail URL (or any other binary content)
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.box.com/2.0/files/76537235577/thumbnail.png?min_height=150&min_width=150", true);
xhr.setRequestHeader("Authorization", "Bearer your_access_token");
xhr.responseType = "blob";
xhr.onload = function(e) {
if (this.status == 200) {
var blob = xhr.response;
var url = URL.createObjectURL(xhr.response);
@mingliangguo
mingliangguo / get box thumbnail url
Created August 1, 2016 03:52
A simpler version to get box thumbnail URI
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.box.com/2.0/files/76537235577/thumbnail.png?min_height=150&min_width=150", true);
xhr.setRequestHeader("Authorization", "Bearer your_access_token");
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
if (this.status == 200) {
var uInt8Array = new Uint8Array(this.response);
var blob = new Blob([uInt8Array], {type: 'application/octet-binary'}); // pass a useful mime type here
var url = URL.createObjectURL(blob);
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.box.com/2.0/files/76537235577/thumbnail.png?min_height=150&min_width=150", true);
xhr.setRequestHeader("Authorization", "Bearer your_access_token");
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
if (this.status == 200) {
var uInt8Array = new Uint8Array(this.response);
var i = uInt8Array.length;
var binaryString = new Array(i);
Error: Failed to update tap: caskroom/versions
brew untap caskroom/cask
brew update
brew cleanup --force -s
rm -rf "$(brew --cache)"
brew tap caskroom/cask
This removed what I believe is a unnecessary single quote in the rm command and a period that was probably not intended after the last command
Also in my case, I needed to add sudo for the remove command
@mingliangguo
mingliangguo / Sublime Text 2 - Useful Shortcuts (Mac OS X)
Last active October 24, 2016 14:37 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts (Mac OS X)
h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
h2. General
| *⌘T* | go to file |
| *⌘⌃P* | go to project |
| *⌘R* | go to methods |
| *⌃G* | go to line |
| *⌘KB* | toggle side bar |
| *⌘⇧P* | command prompt |