Skip to content

Instantly share code, notes, and snippets.

View Akaneiro's full-sized avatar
💩

Igor Zheglov Akaneiro

💩
View GitHub Profile
@Akaneiro
Akaneiro / README.md
Created July 7, 2022 10:22 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Akaneiro
Akaneiro / center_on_canvas.kt
Last active October 16, 2020 09:03
Code for centering text on canvas
private val textRect = Rect()
private fun drawCenter(canvas: Canvas, paint: Paint, text: String) {
canvas.getClipBounds(textRect)
val cHeight = textRect.height()
val cWidth = textRect.width()
paint.apply {
textAlign = Paint.Align.LEFT
getTextBounds(text, 0, text.length, textRect)
}
@Akaneiro
Akaneiro / branch-rename.sh
Last active July 18, 2022 16:30 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote