Skip to content

Instantly share code, notes, and snippets.

View DanielJette's full-sized avatar

Daniel Jette DanielJette

View GitHub Profile
@DanielJette
DanielJette / completion-for-gradle.md
Last active April 14, 2016 14:48 — forked from nolanlawson/completion-for-gradle.md
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@DanielJette
DanielJette / OrientationLoggingActivity.java
Last active March 9, 2017 16:00
OrientationEventListener to log orientation changes
public abstract class OrientationLoggingActivity extends AppCompatActivity {
private OrientationEventListener orientationEventListener = null;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
orientationEventListener = new OrientationEventListener(this) {
@DanielJette
DanielJette / gradle.properties
Created April 24, 2019 21:03
How to debug a gradle plugin
org.gradle.debug=true
@DanielJette
DanielJette / rename-it.rb
Created April 25, 2019 14:08
Rename fixtures and screenshots
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'find'
def rename_files(pattern, new_name)
file_paths = []
Find.find('.') do |path|
file_paths << path if path =~ /#{pattern}/
@DanielJette
DanielJette / show_lang.sh
Created May 26, 2019 20:55
Simple script to count java and kotlin files in a project
#!/bin/sh
if [ -z "$1" ]; then
echo "Please specify a project"
echo " e.g. show_lang.sh Polaris/Core"
exit 1
fi
BASEDIR=$(dirname "$0")
@DanielJette
DanielJette / BundleTooLargeException.kt
Created April 28, 2022 20:09
Validate the bundle
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import androidx.annotation.VisibleForTesting
import com.shopify.foundation.extensions.parceledSize
import com.shopify.foundation.util.BuildConfig
private const val BUNDLE_SIZE_WARNING_THRESHOLD = 100000
private const val LOG_TAG = "BundleValidator"
private const val BUNDLE_TAG = "INSTANCE_ID"