Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Cirksena grumpyshoe

  • Oldenburg, Germany
View GitHub Profile
View gist:548045ee22e937e40db1b266babd6e2f
Example of how to reset a master branch to a specific commit (doen't matter which branch of)
git checkout master
git reset --hard <newBaseCommitId>
git push -f origin master
git merge <speceficCommitId>
git push origin master
@grumpyshoe
grumpyshoe / gist:c3a5183b08fe4492c1091deba779f293
Created Jan 3, 2017
How to rename a git branch locally and remote
View gist:c3a5183b08fe4492c1091deba779f293
git branch -m old_branch new_branch # Rename your branch locally
git push origin :old_branch # Delete the old remote branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
View gist:d65a286ce87bb7965abf17b5a030055c
public static Bitmap loadBitmapFromView(View v) {
b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
v.draw(c);
if (v.getMeasuredHeight() <= 0) {
v.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Bitmap b = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
@grumpyshoe
grumpyshoe / gist:fdcddeed2c70c0b2b0d69428ce83ecca
Created Nov 22, 2016
Espresso: How to add intent Extras/Bundle to IntentsTestRule
View gist:fdcddeed2c70c0b2b0d69428ce83ecca
@Rule
public IntentsTestRule<MainActivity> mTestRule = new IntentsTestRule<MainActivity>(MainActivity.class){
@Override
protected Intent getActivityIntent() {
Context targetContext = InstrumentationRegistry.getInstrumentation()
.getTargetContext();
Intent result = new Intent(targetContext, MainActivity.class);
result.putExtra("Name", "Value");
return result;
}
View console_mac_hints,txt
List all dns-server:
scutil --dns | grep 'nameserver\[[0-9]*\]'
@grumpyshoe
grumpyshoe / android_hint.txt
Last active Apr 9, 2016
This is just a collection of my hints to remind myself. I this will help anybody, I'm happy ;)
View android_hint.txt
Start AVD using comupters VPN tunnel:
emulator -avd <avd-name> -dns-server <IPs, comma seperated>
e.g. emulator -avd Nexus_5_API_23_x86 -dns-server 192.168.1.2,192.168.1.3