Skip to content

Instantly share code, notes, and snippets.

View abatilo's full-sized avatar

Aaron Batilo abatilo

View GitHub Profile
#!/usr/bin/racket
#lang racket
(define sum
(lambda (x)
(if (null? x)
0
(if (cons? x)
(if (number? (car x))
(+ (car x) (sum (cdr x)))
(+ (sum (car x)) (sum (cdr x))))
<TextView
android:width="match_parent"
android:height="match_parent"
android:text="Hello world!"
/>
@abatilo
abatilo / EmptyActivity.java
Created February 27, 2017 00:01
An empty activity used only for hosting a fragment to UI test with Espresso
public class EmptyActivity extends AppCompatActivity {
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
@RunWith(AndroidJUnit4.class) public class FragmentTest {
// Setup an ActivityTestRule as such that the Activity is not launched until we say so
@Rule public ActivityTestRule<EmptyActivity> rule =
new ActivityTestRule<>(EmptyActivity.class, true, false);
private Fragment fragment;
private EmptyActivity activity;
@Before public void setup() {
@RunWith(AndroidJUnit4.class) public class FragmentTest {
// Setup an ActivityTestRule as such that the Activity is not launched until we say so
@Rule public ActivityTestRule<EmptyActivity> rule =
new ActivityTestRule<>(EmptyActivity.class, true, false);
private Fragment fragment;
private EmptyActivity activity;
@Before public void setup() {
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment"
android:name="whatever.here.MainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_main"
/>
@abatilo
abatilo / gist:ca9870ffc6c3825aecf1dd5ec7500719
Created March 16, 2017 00:47
Add to .bashrc to make committing all files and pushing easy
gac() { git add -A && git commit -m "$*" && git push; }
# Deletes local branches if they don't exist on the remote
alias prune=`git fetch --prune --all && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d`
@abatilo
abatilo / README-Template.md
Created November 9, 2017 01:15 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@abatilo
abatilo / core.clj
Created January 28, 2018 15:42
Clojure fibonacci
(ns flyr.core)
(defn fib [n]
(if (= 0 n)
0
(if (= 1 n)
1
(+ (fib (- n 1)) (fib (- n 2))))))
(defn -main