Skip to content

Instantly share code, notes, and snippets.

View MaartenS's full-sized avatar

Maarten MaartenS

View GitHub Profile

When using pagers in Fragment you need to use getChildFragmentManager instead of getSupportFragmentManager(). Otherwise the page will not be redrawn when activity pauses.

float scale = getResources().getDisplayMetrics().density;
dpAsPixels = (int) (sizeInDp * scale + 0.5f);
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from pyquery import PyQuery as pq
import string

print '📽' # 🎥'

series = ['face_off', 'new_girl', 'big_bang_theory']
for serie in series:
git submodule update --init 
git submodule foreach 'git checkout version/api' 

composer install 
composer dumpautoload -o

A curated list of shell commands and tools specific to OS X.

“You don’t have to know everything. You simply need to know where to find it when necessary.” (John Brunner)

Awesome Gitter

For more terminal shell goodness, please also see this list's sister list Awesome Command Line Apps.

public class MyActivity extends Activity{

    private Handler mHandler = new Handler();

}
Timer timer = new Timer();

Remove the background shade and dialog background from an Android Dialog

final Dialog dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog.setContentView(R.layout.overlay_loading);
        dialog.setCancelable(false);
 dialog.show();
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:+31882050505"));
startActivity(intent);

Otto eventbus

post an event

BusProvider.getInstance().post(new FooEvent());

subscribe to an event