Skip to content

Instantly share code, notes, and snippets.

@Windsooon
Windsooon / leetcode_retag.md
Last active April 23, 2024 03:59
Retag most popular Leetcode problems

osjobs

海外兔

website

@SandroMachado
SandroMachado / convert-to-webp.sh
Last active January 13, 2021 01:11
Script to convert all the `JPEG` images to the `WEBP` format in your Android project
#/bin/sh
# Inpiration: http://engineeringblog.yelp.com/2016/05/yelp-android-app-went-on-a-diet.html
# `-lossless` not used to give support for Android 4.0+
# Make sure cwebp is installed.
if ! type "cwebp" > /dev/null; then
echo "Please install cwebp to continue:"
echo "brew install webp"
exit 1
fi
@lopspower
lopspower / REAMDE.md
Last active August 16, 2021 04:19
Increase Android Studio memory

Increase Android Studio memory

Twitter

Locate the configuration file

Run command:

touch ~/Library/Preferences/AndroidStudioX.X/studio.vmoptions
@tunjos
tunjos / copyReleaseApkToCustomDir.gradle
Last active December 8, 2021 03:10
Copy release apk to custom directory
def publish = project.tasks.create("copyReleaseApkToCustomDir")
publish.description "Copies release apk to custom directory"
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.each { output ->
if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy)
def outputFile = output.outputFile
println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.apk"
@mcginty
mcginty / material_colors.xml
Last active March 17, 2022 04:09
Android XML resource with the full material color palette. Source: http://www.google.com/design/spec/style/color.html#color-color-palette
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="material_red50">#ffffebee</color>
<color name="material_red100">#ffffcdd2</color>
<color name="material_red200">#ffef9a9a</color>
<color name="material_red300">#ffe57373</color>
<color name="material_red400">#ffef5350</color>
<color name="material_red500">#fff44336</color>
<color name="material_red600">#ffe53935</color>
<color name="material_red700">#ffd32f2f</color>
@idanakav
idanakav / percent_example
Created May 29, 2015 08:35
Percent library
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.percent.PercentRelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
@lorenzos
lorenzos / android-screen-to-gif.sh
Last active March 30, 2019 21:00
Captures screen from Android device via ADB and makes a 180x320 GIF
#!/bin/bash
# How to install:
# exo-open "http://developer.android.com/sdk/index.html#Other"
# sudo apt-get install libav-tools imagemagick
# wget https://gist.githubusercontent.com/lorenzos/e8a97c1992cddf9c1142/raw/android-screen-to-gif.sh
# chmod a+x android-screen-to-gif.sh
# Help message
function usage() {
@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@broady
broady / 1MarkerAnimation.java
Last active March 13, 2024 12:44
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;