I hereby claim:
- I am stustirling on github.
- I am stuart_stirling (https://keybase.io/stuart_stirling) on keybase.
- I have a public key ASCLtac4XRN_eQGiTPu9aw6PqszYqC5mTHvaW3wkV2P5mQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/** | |
* This method is to change the country code like "us" into 🇺🇸 | |
* Stolen from https://stackoverflow.com/a/35849652/75579 | |
* 1. It first checks if the string consists of only 2 characters: ISO 3166-1 alpha-2 two-letter country codes (https://en.wikipedia.org/wiki/Regional_Indicator_Symbol). | |
* 2. It then checks if both characters are alphabet | |
* do nothing if it doesn't fulfil the 2 checks | |
* caveat: if you enter an invalid 2 letter country code, say "XX", it will pass the 2 checks, and it will return unknown result | |
*/ | |
fun String.toFlagEmoji(): String { | |
// 1. It first checks if the string consists of only 2 characters: ISO 3166-1 alpha-2 two-letter country codes (https://en.wikipedia.org/wiki/Regional_Indicator_Symbol). |
data class PreviousAndLatest<T>( | |
var previous: T?, | |
var latest: T? | |
) { | |
fun addLatest(newLatest: T): PreviousAndLatest<T> { | |
if (latest != null) previous = latest | |
latest = newLatest | |
return this | |
} | |
} |
# Push tags matching specific pattern (this example will match all tags starting with "release/") | |
git tag -l "release/*" | xargs -n 1 -I% git push origin % | |
# Output list of ticket ids that have been merged since the last commit. Replace `HEAD^1` with a specific commit id if you like. | |
git rev-list HEAD^1..HEAD --oneline --date-order | grep "\[EXEP-.*\]\|\[SS-.*\]" -o | sort -u | tr -d '[',']' | |
# Get the short version of the current commit hash | |
git rev-parse --short HEAD |
task copyFiles(type: Copy) { | |
from "$projectDir/src/flavorDevelop/cpp/" | |
into "$projectDir/src/develop/cpp/" | |
} | |
tasks.whenTaskAdded { task -> | |
if (task.name == 'preFlavorDevelopDebugBuild') { | |
task.dependsOn copyFiles | |
} | |
} |
def getVersionName = { -> | |
try { | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine 'git', 'describe', '--match', "dev/[0-9]*.[0-9]*.[0-9]*", "--abbrev=0", 'HEAD' | |
standardOutput = stdout | |
} | |
return stdout.toString().replace("version/","").trim() | |
} | |
catch (ignored) { |
/** | |
* Generates a checksum for a file. | |
*/ | |
fun File.checksum() : Long? { | |
val crc = CRC32() | |
crc.update(readBytes()) | |
return crc.value | |
} |