Skip to content

Instantly share code, notes, and snippets.

View mcxiaoke's full-sized avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
@mcxiaoke
mcxiaoke / bash rename
Created September 5, 2013 02:00
bash rename
for i in `ls`; do newName=`echo $i |cut -d] -f2`; echo $newName;mv $i $newName;done
@mcxiaoke
mcxiaoke / lolcat.rb
Created September 6, 2013 06:06 — forked from xaethos/lolcat.rb
#!/usr/bin/env ruby
require 'colorize'
require 'optparse'
class LOLCat
def initialize options = {}
@tagspecs = options[:tagspecs] || []
@whitelist = options[:processes] || []
@processes = Hash.new
end
@mcxiaoke
mcxiaoke / precheck
Created September 6, 2013 08:39
Pre-Commit Build Check for Android Maven/Gradle Project
#!/bin/sh
#
# Name: Pre-Commit Build Check
# Author: [email protected]
#
# build project before commit
# if build failed, commit will be refused.
echo "execute 'mvn clean package', waiting..."
mvn clean package > /dev/null 2>&1
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
package net.vvakame.sapmle;
import java.util.List;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import android.view.ActionProvider;
import android.view.Menu;
package com.psrivastava.deviceframegenerator.widget;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
@mcxiaoke
mcxiaoke / .gitconfig
Last active August 31, 2016 20:37 — forked from robmiller/.gitconfig
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
@mcxiaoke
mcxiaoke / AdvancedShareActionProvider.java
Created October 23, 2013 07:00
Advanced ShareActionProvider
package com.douban.ui.widget;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
buildscript {
repositories {
// rather than hit central each time with this:
// mavenCentral()
// we hit our company Nexus server ont he public group
// which includes the Central Repository
// and is local, so more performant
maven {
url "http://localhost:8081/nexus/content/groups/public"
}