This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Manage your Flutter app development. | |
Common commands: | |
flutter create <output directory> | |
Create a new Flutter project in the specified directory. | |
flutter run [options] | |
Run your Flutter application on an attached device or in an emulator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2013 The Flutter Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void updateList(@NonNull List<Device> newDevices) { | |
// Sort new list | |
Collections.sort(newDevices, mComplicatedComparitor); | |
//Calculate difference between old and new list | |
DiffUtil.DiffResult result = DiffUtil.calculateDiff(new CustomDiffCallback(mDevices, newDevices)); | |
//Wipe old list and replace with sorted new list | |
mDevices.clear(); | |
mDevices.addAll(newDevices); | |
//Let diff handle ui update calls to adapter | |
result.dispatchUpdatesTo(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Apply by adding the following line to your build.gradle: | |
// apply from: 'scripts/check_for_git_hooks.gradle' | |
// Comment out any hook files that aren't relevant for you. | |
final GIT_HOOK_DIR = ".git/hooks/" | |
final IGNORE_HOOKS_FLAG = "ignoreMissingHooks" | |
final GIT_HOOK_FILES = [ | |
"applypatch-msg", | |
"commit-msg", | |
"post-applypatch", | |
"post-checkout", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mp4togif() { | |
FILTERS="fps=30,scale=w='if(gt(iw,ih),-1,480)':h='if(gt(iw,ih),480,-1)':flags=lanczos" | |
TEMP="$(mktemp -t mp4togif).png" | |
echo "Creating palette..." | |
ffmpeg -v warning -i $1 -vf "$FILTERS,palettegen" -y "$TEMP" | |
echo "Encoding GIF..." | |
ffmpeg -v warning -i $1 -i "$TEMP" -lavfi "$FILTERS[x];[x][1:v]paletteuse=dither=floyd_steinberg" -y -f gif "$1.gif" | |
echo "Done!" | |
} | |
#Credit @jakewharton ASG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > <LOCATION HERE> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find all xml files `find res -name "*.xml"` | |
# then serch them for a # followed by 0-f 6 times (will find either rgb or argb) | |
find res -name "*.xml" -exec grep -Hn "#[0-9a-fA-F]\{6\}" {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ResolveInfo activityInfo = (ResolveInfo) mDataModel.getActivity(position) | |
Drawable icon = activityInfo.loadIcon(packageManager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Gerrit is dumb ## | |
#################### | |
alias gerrit='ssh -p 29418 <wherever you run gerrit> gerrit' | |
# Usage # | |
# gerritIds <project> | |
# will list all change ids by you that are open for <project> | |
# useful to find what ids will will be abandoned by abandonALl | |
gerritIds() { | |
gerrit query --format=JSON --patch-sets -- status:open project:$1 | grep -v runTimeMilliseconds | grep -E "`git config user.email`" | grep -E -o '"number":"\d\d+"' | tr '"' ' ' | cut -d' ' -f4- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Launch default activity in apk## | |
# Commands are surrounded in triple quotes ''' | |
#'''adb shell am start -n <package name>/<activity name>''' will start activity | |
#'''`<command here>`''' will evaluate command in back ticks | |
#'''aapt dump badging <your apk file>.apk''' will print a bunch of things including the package and default activity | |
#'''grep -o "package.*[\.][a-zA-Z]*[\']\|launchable-activity.*[\.][a-zA-Z]*[\']"''' will match either the package or activity | |
#'''| grep -o "['][a-zA-Z\.].*[']"''' then strip out everything but what we want surrounded by quotes | |
#'''sed "s/'//g"''' strip quotes | |
#'''sed -n -e ":a" -e "$ s/\n/\//gp;N;b a"''' replace newline with forward slash | |
adb shell am start -n `aapt dump badging <your apk file>.apk | grep -o "package.*[\.][a-zA-Z]*[\']\|launchable-activity.*[\.][a-zA-Z]*[\']" | grep -o "['][a-zA-Z\.].*[']" | sed "s/'//g" | sed -n -e ":a" -e "$ s/\n/\//gp;N;b a"` |