Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kaushikgopal on github.
  • I am kaushikgopal (https://keybase.io/kaushikgopal) on keybase.
  • I have a public key ASDR8pa7M7GjmOJwED8ae0Cmr7Uyuk13EJDW0fs7kG8TlQo

To claim this, I am signing this object:

@kaushikgopal
kaushikgopal / .phoenix.2.js
Last active October 7, 2018 02:02
Kaushik Gopal's window management tool of choice - phoenix.js
// download Phoenix from here https://github.com/kasper/phoenix
"use strict";
Phoenix.set({
openAtLogin: true
});
// -------------------------------------------
// Utility methods
@kaushikgopal
kaushikgopal / git_merge_up_push_up_version.rb
Created October 25, 2016 06:01
ruby script that makes merging up and pushing changes easy for versions ahead (if you follow semantic versioning)
#!/usr/bin/env ruby
require 'rubygems'
require 'set'
require 'highline/import'
# this assumes you follow proper semantic app versioning
# listen to this http://fragmentedpodcast.com/episodes/054/ for an explanation
def confirm(message)
confirmation = ask message + " (y/n)"
@kaushikgopal
kaushikgopal / android_app_release.rb
Created October 7, 2016 20:04
a ruby release script for android apps
#!/usr/bin/env ruby
require 'highline/import'
require 'nokogiri'
# i suggest looking at this folder and seeing your app prefix ¯\_(ツ)_/¯
$gradle_properties = File.join(File.dirname(__FILE__), "..", "..", "gradle.properties")
$app_directory = "./<App Parent Directory>"
$app_name_prefix = "<Prefix for final apk e.g. uber-release->"
$splash_screen_location = "co.kaush.instashop/co.kaush.instashop.SplashActivity"
@kaushikgopal
kaushikgopal / DateSubject.java
Created October 3, 2016 21:53
DateSubject - custom Truth extension subject for comparing Dates
import com.google.common.truth.FailureStrategy;
import com.google.common.truth.Subject;
import com.google.common.truth.SubjectFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import static com.google.common.truth.Truth.assert_;
public class DateSubject
@kaushikgopal
kaushikgopal / Junit4EnclosedTestRunnerExample.java
Created July 24, 2016 03:53
Sample use of the Enclosed.class test runner
@RunWith(Enclosed.class)
public class WorkflowStateMachineTest {
@RunWith(Parameterized.class)
public static class ParameterizedTests {
@Parameter public ISBatchType mTestBatchType; // first data value (0) is default
@kaushikgopal
kaushikgopal / RxSchedulerHook.java
Created July 8, 2016 16:50
Lazy man's RxJava Espresso Scheduler Hooks
public class RxSchedulerHook {
private ISRxSchedulerHook() {
// no instances
}
/**
* this makes sure that when we run the tests all of RxJava
* operates on a single thread (Scheduler.immediate)
*/
@kaushikgopal
kaushikgopal / LogExOnlySubscriber.java
Last active February 1, 2022 16:29
RxJava log exception only subscriber
public static class LogExOnlySubscriber<T> extends Subscriber<T> {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable ex) {
Timber.e(ex, "Your RX IZ FAILING YO!");
}
@kaushikgopal
kaushikgopal / .gitconfig
Created July 8, 2016 16:39
KG's gitconfig
[alias]
l = !git --no-pager log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -30
ll = !git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
la = !git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
tree = log --oneline --decorate --graph # display git log as a tree
st = status
ss = !"ss() { git status -s | awk '{print NR,$0}' | awk -F: '{ print \"\\033[1;30m\" $1 \"\\033[0m\" }'; }; ss"
# view status of files changed
@kaushikgopal
kaushikgopal / RxFirebase.java
Created July 4, 2016 18:44 — forked from gsoltis/RxFirebase.java
RxJava Bindings for Firebase
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {