Skip to content

Instantly share code, notes, and snippets.

View vilmarbfilho's full-sized avatar
🤖
Trying make a world a better place

V1lm4r vilmarbfilho

🤖
Trying make a world a better place
View GitHub Profile
@vilmarbfilho
vilmarbfilho / gist:32502b5c9459c370d5f4
Created May 23, 2015 19:35
Get context application Robolectric
Just use for version 1.x and 2.x:
Robolectric.application;
And for version 3.x:
RuntimeEnvironment.application;
Link: http://stackoverflow.com/questions/13684094/how-can-we-access-context-of-an-application-in-robolectric
@vilmarbfilho
vilmarbfilho / gist:801676577795adc5adfd
Created June 1, 2015 12:12
Push a new local branch to a remote Git repo
git push -u origin <branch-name>
URL: http://stackoverflow.com/questions/2765421/push-a-new-local-branch-to-a-remote-git-repo-and-track-it-too
@vilmarbfilho
vilmarbfilho / gist:0049dabc170daa4b521f
Created June 6, 2015 19:26
Run command with sudo
sudo env "PATH=$PATH" cmd
URL: http://superuser.com/questions/709515/command-not-found-when-using-sudo
@vilmarbfilho
vilmarbfilho / gist:3807d919682c0a491d3a
Created June 10, 2015 01:30
How Can I Download an Entire Web Site?
wget -r --no-parent http://site.com/songs/
URL: http://www.howtogeek.com/171948/how-can-i-download-an-entire-web-site/
first step: git merge <branch>
second step: solve conflicts
third step: git commit
java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");
Device Real:
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
Emulador:
adb -d forward tcp:5601 tcp:5601
@vilmarbfilho
vilmarbfilho / gist:d6cea0ffc22025010d66
Last active February 1, 2016 11:45
Life cycle activity android
public class BaseActivity extends AppCompatActivity{
private static final String TAG = "base_activity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate()");
}
@vilmarbfilho
vilmarbfilho / gist:b9d73b52a5236188c2f9
Created February 1, 2016 11:50
Life cycle fragment android
public class BaseFragment extends Fragment{
private static final String TAG = "base_fragment";
@Override
public void onAttach(Context context) {
super.onAttach(context);
Log.i(TAG, "onAttach()");
}
@vilmarbfilho
vilmarbfilho / gist:2726699434a3b370a2ef8255711444a4
Created June 13, 2016 16:26
Change name APK using gradle
android.applicationVariants.all { variant ->
def appName
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}
variant.outputs.each { output ->
def newApkName