Skip to content

Instantly share code, notes, and snippets.

View codeprogression's full-sized avatar

Richard Cirerol codeprogression

View GitHub Profile
@codeprogression
codeprogression / ExamplePoller.java
Last active January 5, 2016 16:11
Encapsulate polling an endpoint using RxJava, OkHttp, and Gson
import com.google.gson.Gson;
import com.squareup.okhttp.OkHttpClient;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class ExamplePoller extends RxPoller<Example> {
@Inject
@codeprogression
codeprogression / - Android MVPB.md
Last active October 14, 2017 14:51
Data Binding Library Presenter Pattern

An updated example is available here: https://github.com/codeprogression/android-mvpb

The updated example does not use the BoundRelativeLayout. It also moves the view state saving to the view rather than in the presenter. The presenter should not have any reference to the Android framework.

namespace CodeProgression.FoodJournal.Core.Data
{
public interface IDatabaseConfiguration {
void Configure();
ITransactionWrapper GetTransaction();
bool IsValid{ get; }
void Register<T>(T instance) where T: class;
@codeprogression
codeprogression / brew_install
Created April 8, 2015 21:37
Paved MacBook Script(ish)
# Install oh-my-zsh (http://ohmyz.sh) _Prompts XCode Command Line Tools install_
# Install Brew (http://brew.sh)
# Install Brew Cask (caskroom.io) brew install caskroom/cask/brew-cask
brew install cask
brew cask install xquartz
brew cask install iterm2
brew install git
brew install ruby
brew install ruby-build
@codeprogression
codeprogression / codeprogression.zsh-theme
Created July 25, 2014 04:37
Code Progression oh-my-zsh theme
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
local machine="%m%"
PROMPT='${ret_status} '
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
#RPROMPT='%{$fg[white]%}%1d$(git_prompt_info) %{$fg_bold[blue]%}${machine}{$reset_color%}'
RPROMPT='%{$fg[white]%}%1~$(git_prompt_info) %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="$(git_remote_status)%{$fg[yellow]%})%{$reset_color%}"
#ZSH_THEME_GIT_PROMPT_SUFFIX=" $(git_time_since_commit)%{$fg[yellow]%})%{$reset_color%}"
@codeprogression
codeprogression / parc.java
Created March 7, 2014 15:53
Android Studio Live Templates
public $CLASS$(Parcel in){
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public static final Parcelable.Creator<$CLASS$> CREATOR = new Parcelable.Creator<$CLASS$>() {
@codeprogression
codeprogression / specrunner.html
Created December 6, 2012 18:39
Jasmine runner for multiple specs (non-AMD)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Spec Runner</title>
<link rel="stylesheet" type="text/css" href="lib/jasmine.css">
<script type="text/javascript" src="../vendor/jquery.js" ></script>
<script type="text/javascript" src="../vendor/require.js" ></script>
<script type="text/javascript" src="lib/jasmine.js" ></script>
@codeprogression
codeprogression / myspec.spec.js
Created December 6, 2012 18:34
Jasmine runner for multiple specs (AMD)
define(['path/to/source', 'jasmine', 'jasmine-ajax'], function (source, jasmine) {
describe('spec description', function(){
// Add specs here
};
});
@codeprogression
codeprogression / removebranch
Last active October 11, 2015 11:58
Removing local and remote branches (for origin remote, while excluding upstream remote)
# To delete all merged local branches (excluding non-origin remotes)
git branch --merged master | grep -v 'master$' | xargs git branch -d
# To delete all merged remote branches (excluding non-origin remotes)
git branch -r --merged master | grep 'origin' | sed 's/ *origin\///' | grep -v 'master$' | xargs -i% git push origin :%
# To remove orphaned remote branch references
git remote | xargs -I% git remote prune %
@codeprogression
codeprogression / gist:3503535
Created August 28, 2012 20:03
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
html, body {
height: 100%;