Skip to content

Instantly share code, notes, and snippets.

Avatar

Francisco Figueiredo Jr. franciscojunior

View GitHub Profile
@franciscojunior
franciscojunior / LiveData.kt
Created Jul 15, 2018 — forked from arekolek/LiveData.kt
LiveData extension property for use in unit tests
View LiveData.kt
val <T> LiveData<T>.blockingValue: T?
get() {
var value: T? = null
val latch = CountDownLatch(1)
observeForever {
value = it
latch.countDown()
}
if (latch.await(2, TimeUnit.SECONDS)) return value
else throw Exception("LiveData value was not set within 2 seconds")
@franciscojunior
franciscojunior / install virtualenv ubuntu 16.04.md
Created Jan 11, 2018 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04
View install virtualenv ubuntu 16.04.md

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
View PlaygroundTests
public class PlaygroundTests {
// Template test using Observables
// Reference: http://docs.couchbase.com/developer/java-2.0/observables.html
@Test
public void test_subscribe0() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
@franciscojunior
franciscojunior / bcb.R
Created Feb 1, 2017 — forked from arademaker/bcb.R
getting data from BCB (Banco Central do Brasil)
View bcb.R
# This script was originally written during for a summer course that I
# gave at FGV in January 2011. The script was used to show the
# students how to retrive data from Banco Central do Brasil
# (http://bcb.gov.br/?SERIETEMP) using SOAP protocol and R.
library(SSOAP)
library(XML)
library(RCurl)
wsdl <- getURL("https://www3.bcb.gov.br/sgspub/JSP/sgsgeral/FachadaWSSGS.wsdl",
@franciscojunior
franciscojunior / introrx.md
Created Dec 19, 2016 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@franciscojunior
franciscojunior / ExpandableCheckBoxesLayout.patch
Created Nov 6, 2016
Patch to add ExpandableCheckboxesLayout
View ExpandableCheckBoxesLayout.patch
diff --git a/app/src/main/java/name/vampidroid/ui/widget/CardFilters.java b/app/src/main/java/name/vampidroid/ui/widget/CardFilters.java
index 4133e99..3ff912e 100644
--- a/app/src/main/java/name/vampidroid/ui/widget/CardFilters.java
+++ b/app/src/main/java/name/vampidroid/ui/widget/CardFilters.java
@@ -19,6 +19,9 @@ import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
+import java.util.Arrays;
+import java.util.List;
@franciscojunior
franciscojunior / continuefirefox.sh
Last active Oct 8, 2016
Stop and continue Firefox processes
View continuefirefox.sh
ps aux | grep -v "grep" | grep -i firefox.app | awk '{print $2}' | xargs kill -CONT
View roundrect.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="30dp"
android:fromDegrees="45"
android:toDegrees="45">
<solid android:color="#00aadd"/>
<corners
android:radius="2dp"
@franciscojunior
franciscojunior / PauseFirefoxSwitchWithPid.applescript
Created Jul 3, 2016
Apple Script to prevent firefox from running while it is without focus
View PauseFirefoxSwitchWithPid.applescript
# Reference http://stackoverflow.com/questions/7741879/if-i-wanted-to-modify-task-switching-in-osx
# Reference http://apple.stackexchange.com/questions/36163/applescript-kill-command-error
# http://lists.apple.com/archives/applescript-users/2012/Nov/msg00070.html
# SIGCONT and SIGSTOP don't work in shell executed by applescript.
# Has to use numbers, or STOP/CONT w/o SIG or use "set +o posix"
# http://unixhelp.ed.ac.uk/CGI/man-cgi?signal+7
# http://superuser.com/questions/14762/execute-applescript-without-open-the-editor
# http://stackoverflow.com/questions/13653358/how-to-log-objects-to-a-console-with-applescript
# http://lists.apple.com/archives/applescript-users/2013/Apr/msg00024.html
# http://en.wikipedia.org/wiki/AppleScript -- for on quit handler
@franciscojunior
franciscojunior / exception.txt
Created Jun 9, 2016
Exception when trying to add a new dictionary entry on my cell phone
View exception.txt
Process: com.android.settings, PID: 23842
java.lang.ClassCastException: com.android.settings.SubSettings cannot be cast to com.android.settings.SettingsActivity
at com.android.settings.UserDictionarySettings.showAddOrEditDialog(UserDictionarySettings.java:195)
at com.android.settings.UserDictionarySettings.onOptionsItemSelected(UserDictionarySettings.java:176)
at android.app.Fragment.performOptionsItemSelected(Fragment.java:2250)
at android.app.FragmentManagerImpl.dispatchOptionsItemSelected(FragmentManager.java:2003)
at android.app.Activity.onMenuItemSelected(Activity.java:3027)
at com.android.internal.policy.impl.PhoneWindow.onMenuIt