Skip to content

Instantly share code, notes, and snippets.

View adipascu's full-sized avatar
👾
TW1oaHBoISBNTUhIUEghISE=

Adrian Pascu adipascu

👾
TW1oaHBoISBNTUhIUEghISE=
View GitHub Profile
@adipascu
adipascu / gist:c888a5f16a95d9e0e9a9
Created November 23, 2014 05:26
Android intents
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 0);
Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts"));
pickContactIntent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); // Show user only contacts w/ phone numbers
startActivityForResult(pickContactIntent, 0);
import android.util.Log;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import timber.log.Timber;
/**
* Taken from https://gist.github.com/adi1133/2e76e69f8541c2d83473
*/
public class CrashlyticsTree extends Timber.Tree {
@adipascu
adipascu / gist:a1004cb49c5028a3acaa
Created September 24, 2015 09:50
Facebook api key
// Add code to print out the key hash
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
BuildConfig.APPLICATION_ID,
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
.addCallAdapterFactory(new CallAdapter.Factory() {
//relevant SO: https://github.com/square/retrofit/pull/1117
RxJavaCallAdapterFactory delegate = RxJavaCallAdapterFactory.create();
@Override
public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) {
//noinspection unchecked
CallAdapter<Observable<?>> delegate2 = (CallAdapter<Observable<?>>) delegate.get(returnType, annotations, retrofit);
return new CallAdapter<Object>() {
@Override
@adipascu
adipascu / .gitignore
Created November 14, 2015 14:00
Android gitignore
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
public class VanillaNav {
/**
* Show the navigation screen for a location
*
* @param context used to call {@link Context#startActivity(Intent)}
//example URL: vanillanav:navigateTo?venueId=8037&referenceId=19144
public func navigate(venueId: Int, destinationId: Int) -> Bool {
let navigateUrl = NSURL(string: "vanillanav:navigateTo?venueId=\(venueId)&referenceId=\(destinationId)")!
let sharedApp = UIApplication.sharedApplication()
if sharedApp.canOpenURL(navigateUrl) {
sharedApp.openURL(navigateUrl)
return true
} else {
let storeUrl = NSURL(string: "itms-apps://itunes.apple.com/ro/app/vanillanav/id1007116984")!
sharedApp.openURL(storeUrl)
org.gradle.daemon=true
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.java.home=/usr/lib/jvm/java-8-oracle/
{
"APIVersion": "5747657",
"Id": 14077,
"Name": "Toma",
"Latitude": 50.069373,
"Longitude": 15.898114,
"Sections": [{
"Id": 9313,
"Name": "Parter",
"Scale": 100.00000,
0x0034032F5A120002439bC4346a8d418Af902169F