Skip to content

Instantly share code, notes, and snippets.

@bdiegel
bdiegel / gradle_dependencies.md
Created September 29, 2018 15:17
Gradle Dependencies
@bdiegel
bdiegel / refresh_gradle_cache.md
Last active September 29, 2018 15:16
Refresh Gradle cache
@bdiegel
bdiegel / Flutter MediaQuery
Created July 31, 2018 00:30
flutter - device pixel ratio
queryData = MediaQuery.of(context);
double devicePixelRatio = queryData.devicePixelRatio;
'size (pixels): w=${queryData.size.width * devicePixelRatio}, h=${queryData.size.height * devicePixelRatio}'
'devicePixelRatio: $devicePixelRatio'
'size: w=${queryData.size.width}, h=${queryData.size.height}'
'textScaleFactor: w=${queryData.textScaleFactor}'
From example:
@bdiegel
bdiegel / reset_git_fork_to_upstream.md
Last active June 12, 2017 00:38
Reset Git fort to upstream

Reset fork to 'upstream'

Clean up a forked repository

git remote add upstream /url/to/original/repo
git fetch upstream
git checkout master
git reset --hard upstream/master  
git push origin master --force 
@bdiegel
bdiegel / update_git_fork.md
Created April 26, 2017 23:20
Keeping a Git fork updated

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@bdiegel
bdiegel / android_data_binding.md
Last active August 29, 2016 13:52
Android Data Binding

Android Data Binding

Support for two-way data binding was recently added to Android data binding. This is an investigation into using data binding with ViewModels.

The Good: Many advantages

  1. View Models: Data binding is a natural fit. Declare your ViewModel as a variable in the layout file and bind to its properties.
  2. Type Safe: No more findViewById or casting views.
  3. View Holder:

Host a static web site on S3:

Walkthrough on AWS Docs

Instructions

Instructions using the web console to create a bucket to host a static web site with a custom domain.

  • Create a Bucket: Click ‘Create a Bucket’. Name your bucket the same name as your custom domain: www.example.com
  • Enable static serving:
    • click on 'Properties’ for your bucket
  • click 'Static Website Hosting’
@bdiegel
bdiegel / circle.yml
Created March 2, 2016 19:01
CircleCI Android build config
#
# Build configuration for Circle CI
#
# @see: https://gist.github.com/donnfelker/7189cad9c6654f918e7e
general:
artifacts:
- /home/ubuntu/your-app-name/app/build/outputs/apk/
machine:
@bdiegel
bdiegel / gen_pubkey.md
Created January 7, 2016 15:05
Generate public key from private key

How to generate a public key from a private key:

ssh-keygen -y -f /path/to/privatekey > /path/to/publickey