Skip to content

Instantly share code, notes, and snippets.

View jobinlawrance's full-sized avatar

Jobin Lawrance jobinlawrance

View GitHub Profile
@ultraon
ultraon / IoUtils.java
Created May 25, 2017 21:37
Utils for I/O operations
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import okhttp3.internal.io.FileSystem;
import okio.BufferedSource;
import okio.Okio;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@MariusVolkhart
MariusVolkhart / FragmentNeedingPermission.java
Created September 4, 2015 19:51
Android M Permission Sample using Support Fragment
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// ... Some magical things
if (ContextCompat.checkSelfPermission(getActivity(), READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
// We have access. Life is good.
setupContactsPicker();
} else if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), READ_CONTACTS)) {
@mikedfunk
mikedfunk / squashing_commits.md
Last active February 22, 2018 13:31
Squashing working commits

Squashing working commits

Let's say you're working on the whizbang feature. You branch off of develop to the new feature/whizbang branch and start coding. You commit with various things along the way. You commit one time and realize you broke it, so you fix it and commit again. Several commits later it's all set, tested, and ready to merge into develop. How do you squish all those intermediate commits into one, finished commit?

From your feature/whizbang branch, type git rebase -i develop

Then you'll get a rebase editor with some helpful comments as a cheatsheet:

Imgur