Skip to content

Instantly share code, notes, and snippets.

View AmandaRiu's full-sized avatar
🏠
Working from home

Amanda Riu AmandaRiu

🏠
Working from home
View GitHub Profile
@alexwen
alexwen / gist:4b337bc669509a696b5b
Created April 25, 2015 15:59
OkHttp Observable Callback
public Observable<FilesWrapper> download(List<Thing> things) {
return Observable.from(things)
.flatMap(thing -> {
File file = new File(getExternalCacheDir() + File.separator + thing.getName());
if (file.exists()) {
return Observable.just(file);
}
Request request = new Request.Builder().url(thing.getUrl()).build();
@kevinxucs
kevinxucs / logcatapp.sh
Created May 23, 2014 01:43
Filter logcat by app package name
#!/bin/bash
usage() {
echo "Usage: $(basename $0) [package] ..."
}
app_package=$1
shift
if [ -z $app_package ]; then
package com.mirth.stevek.rxtest;
import rx.Observable;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.functions.Func3;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;
@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: