Skip to content

Instantly share code, notes, and snippets.

@emil10001
emil10001 / helpful_git.sh
Last active March 17, 2024 00:07
helpful git commands
# veiw all branches, local and remote
git branch -a
# checkout and switch to remote branch
git checkout -b somebranch origin/somebranch
# if something's screwwed up, or it didn't quite work
git pull
git reset --hard origin/somebranch
@emil10001
emil10001 / reconnect_tmux.sh
Created September 26, 2013 01:28
List and re-connect to an existing tmux session
# list tmux sessions
tmux list-sessions
# attach to session
tmux attach -t <session name/number>
@emil10001
emil10001 / BusProvider.java
Last active August 24, 2016 17:16
BusProvider as enum
public final enum BusProvider {
INSTANCE;
public final Bus BUS;
private BusProvider() {
BUS = new Bus();
}
}
public class DumbLoader extends CursorLoader {
private static final String TAG = "DumbLoader";
public DumbLoader(Context context) {
super(context);
}
@Override
public Cursor loadInBackground() {
// this is just a simple query, could be anything that gets a cursor
@emil10001
emil10001 / git_reset_soft
Created September 3, 2013 16:53
remove last local git commit, without changing any files
git reset --soft HEAD^
@emil10001
emil10001 / clone_git_submodule.sh
Last active December 22, 2015 05:49
Create a submodule in a git project
# where bar.git is the main project
git clone --recursive git://github.com/foo/bar.git
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// details omitted
mPane = (SlidingPaneLayout) findViewById(R.id.pane);
mPane.openPane();
getSupportFragmentManager().beginTransaction()
public class MainActivity extends ActionBarActivity {
private String[] mPlanetTitles;
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private CharSequence mTitle;
private ActionBarDrawerToggle mDrawerToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
public class MainActivity extends ActionBarActivity {
@emil10001
emil10001 / build.gradle
Last active December 21, 2015 13:49
android, intellij, gradle
// lives in the project directory
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}