Skip to content

Instantly share code, notes, and snippets.

View westonal's full-sized avatar

Alan Evans westonal

View GitHub Profile
@davidvavra
davidvavra / NonNullAssertionDetector.kt
Created March 22, 2019 17:06
Lint check for detecting non-null assertion (!!) in your code
import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.*
import org.jetbrains.uast.UElement
import org.jetbrains.uast.UPostfixExpression
class NonNullAssertionDetector : Detector(), Detector.UastScanner {
override fun getApplicableUastTypes(): List<Class<out UElement>>? {
return listOf(UPostfixExpression::class.java)
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phit
phit / gradlesigning.md
Last active May 28, 2022 08:50
Gradle Signing for Dummies
@alainperry
alainperry / NbEnLettres.groovy
Last active March 16, 2017 01:39
Code groovy plutôt sale (mais très fonctionnel) adapté de http://stackoverflow.com/a/3911987/1168698 pour convertir un montant (peut en réalité être utilisé pour tout nombre) en lettres.
Number.metaClass.formatAsCurrency { withWords = false ->
def puissances = ["", "mille", "million", "milliard", "billion", "billiard", "trillion", "trilliard"]
def dizaines = ["", "", "vingt", "trente", "quarante", "cinquante", "soixante", "soixante", "quatre-vingt", "quatre-vingt"]
def unites = ["", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf"]
def chiffres = ["", ""] + unites[2..10]
def unitesEnLettres = { nombre ->
// débrayage immédiat pour 80, ce qui simplifie le code ensuite
if (nombre == 80)
return dizaines[8] + 's'

Keybase proof

I hereby claim:

  • I am diafygi on github.
  • I am diafygi (https://keybase.io/diafygi) on keybase.
  • I have a public key whose fingerprint is F75B E4E6 EF6E 9DD2 0367 9E94 E7F6 FAD1 72EF EE3D

To claim this, I am signing this object:

@diafygi
diafygi / LICENSE.txt
Last active November 20, 2023 20:59 — forked from 140bytes/LICENSE.txt
Base58 Encoder/Decoder - slightly over 140 bytes, but still pretty useful
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@dmarcato
dmarcato / strip_play_services.gradle
Last active December 21, 2022 10:10
Gradle task to strip unused packages on Google Play Services library
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@almozavr
almozavr / app_build.gradle
Created June 26, 2014 08:13
Workaround to bypass library's BuildConfig.DEBUG (always true, always release build type) via custom variable
// Application
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
/***
InputCapture.ino
Timer 1 high-resolution timing facility.
Copyright (C) 2008-2012 Bill Roy
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@michaelkirk
michaelkirk / show-remote-branch-info.sh
Created May 4, 2012 16:51
sort remote branches by age
#!/bin/sh
#
# Too many crusty old git branches? Run this to find likely candidates for deletion
# It lists all the remote branches and sorts them by age.
#
# Folks at pivotal shared this with me
#
#$ . show-remote-branch-info.sh
# 2012-05-04 09:42:29 -0700 4 minutes ago Ted & Bill \torigin/hey_Bill