Skip to content

Instantly share code, notes, and snippets.

export GRADLE_DEFAULT_OPTS='--offline'
function upfind() {
dir=`pwd`
while [ "$dir" != "/" ]; do
@MichaelEvans
MichaelEvans / copr.md
Created January 13, 2020 00:03 — forked from gvaughn/copr.md
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

@MichaelEvans
MichaelEvans / copr.md
Created January 13, 2020 00:03 — forked from gvaughn/copr.md
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

@MichaelEvans
MichaelEvans / Gemfile
Created July 26, 2016 15:08 — forked from neoeno/Gemfile
Pokemon Go Slack Bot
source "https://rubygems.org"
gem "httparty"
gem "geocoder"
gem "slack-poster"
@MichaelEvans
MichaelEvans / appcompat.diff
Last active March 27, 2016 13:39
Changelog for Support Libraries v23.2.0 -> v24.0.0-alpha1
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState
--- appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState 1969-12-31 19:00:00.000000000 -0500
+++ appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState 2016-03-09 19:28:22.000000000 -0500
@@ -0,0 +1,5 @@
+public final class android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState {
+ public boolean qwertyMode;
+ public boolean hasPanelItems();
+ public void clearMenuPresenters();
+}
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.view.WindowCallbackWrapper appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.view.WindowCallbackWrapper
@MichaelEvans
MichaelEvans / google_plus.rb
Created April 13, 2014 16:13
Plugin to embed G+ posts inside Octopress posts
module Jekyll
class GooglePlusEmbedTag < Liquid::Tag
@post = nil
@height = ''
@width = ''
def initialize(tag_name, markup, tokens)
if markup =~ /(https:\/\/plus.google.com\/\d+\/posts\/\w+)/i
@url = $1
@MichaelEvans
MichaelEvans / TimeDialog.java
Created January 7, 2016 05:47
Wrapper on {@code TimePickerDialog} to control min and max times.
/**
* Wrapper on {@code TimePickerDialog} to control min and max times.
*/
public class TimeDialog extends TimePickerDialog {
private Time mMinTime;
private Time mMaxTime;
public static TimeDialog create(Context context, OnTimeSetListener callBack,
int hour, int minute, boolean is24HourView, long min, long max) {
Time time = getBoundedTime(hour, minute, min, max);
return new TimeDialog(context, callBack, time.hour, time.minute,
/**
* From a file that contains
* doc_id w1 w2 w3 ... lines, separated by tabs
* return an inverted index Map of w -> Set(doc_id)
*
* @param filename well isn't it obvious
* @return Map[String,Set[String]]
*/
import scala.collection.immutable.Map
@MichaelEvans
MichaelEvans / horace.rb
Created January 23, 2014 04:02
horace.rb
require 'digest/sha1'
class Miner
attr_reader :tree, :parent, :timestamp
def initialize
@tree=`git write-tree`.chomp
@parent=`git rev-parse HEAD`.chomp
@timestamp=12345
end
require 'digest/sha1'
tree = `git write-tree`
parent = `git rev-parse HEAD`
puts "Tree: #{tree}"
puts "Parent: #{parent}"
def test(start, tree, parent)
sha1 = "9403248290"
counter = start