Skip to content

Instantly share code, notes, and snippets.

View PrashamTrivedi's full-sized avatar
🏠
Working from home

Prasham Trivedi PrashamTrivedi

🏠
Working from home
View GitHub Profile
@ValCanBuild
ValCanBuild / drawer_layout_preview.xml
Created September 10, 2015 09:35
Android preview DrawerLayout NavigationView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
@kpbird
kpbird / MemoryLimits
Created July 24, 2013 11:34
How to identify memory limits per application in your Android device. This solution require API level 11.
package com.example.androidnative;
import android.app.Activity;
import android.app.ActivityManager;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity {
@Override
# PROJECT `.gitignore`
# put it in the *root* of your project
# most likely just append this line to the already existing file
/secret.properties
@alexjlockwood
alexjlockwood / ObjectAnimatorCompat.java
Last active January 1, 2018 10:52
ObjectAnimator motion along a path for pre-Lollipop devices (https://j.mp/object-animator-path-motion)
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
#!/bin/sh
# Copy templates to Android Studio in default location
TMP_PATH=`pwd`
TEMPLATES_PATH="/Applications/Android Studio.app/Contents/plugins/android/lib/templates/other"
DIRS=`find $TMP_PATH -type d -maxdepth 1 -not -name '.*' -not -path $TMP_PATH`
for f in $DIRS
@donnfelker
donnfelker / config
Last active November 19, 2019 11:28
Watch or Unwatch a file in git
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged
@CodingDoug
CodingDoug / README.md
Last active October 3, 2020 20:18
Uploading images to Cloud Storage via the web and identifying them with Google Cloud Vision API

Uploading images to Cloud Storage via the web and identifying them with Google Cloud Vision API

If you're trying to do this, you came to the right place!

Watch this code work in real time: https://twitter.com/CodingDoug/status/945035556555186176

Setup

These instructions assume that you already have a Firebase project, and billing is enabled. Billing is required to use the Vision API.

@android10
android10 / README.md
Last active November 29, 2020 00:50
Keep a FORKED repository synced with UPSTREAM on Github

Configure a remote that points to the upstream repository in Git.

  • List the current configured remote repository for your fork.
git remote -v
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (push)
@donnfelker
donnfelker / .gitconfig
Last active August 15, 2021 10:05
My .gitconfig
[user]
name = FirstName LastName
email = you@yourdomain.com
[alias]
A = add -A
a = add
aa = add --all
ae = add --edit
ai = add --interactive
amend = commit --amend -C HEAD
@TomTasche
TomTasche / feedback_android.java
Created October 21, 2012 12:22
Use built-in feedback mechanism on Android
// more information here: http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html
try {
int i = 3 / 0;
} catch (Exception e) {
ApplicationErrorReport report = new ApplicationErrorReport();
report.packageName = report.processName = getApplication()
.getPackageName();
report.time = System.currentTimeMillis();
report.type = ApplicationErrorReport.TYPE_CRASH;