This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CircleTransform : Transformation { | |
| override fun transform(source: Bitmap): Bitmap { | |
| val size = Math.min(source.width, source.height) | |
| val x = (source.width - size) / 2 | |
| val y = (source.height - size) / 2 | |
| val squaredBitmap = Bitmap.createBitmap(source, x, y, size, size) | |
| if (squaredBitmap != source) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| (uf: "AC", name: "Acre"), | |
| (uf: "AL", name: "Alagoas"), | |
| (uf: "AP", name: "Amapá"), | |
| (uf: "AM", name: "Amazonas"), | |
| (uf: "BA", name: "Bahia"), | |
| (uf: "CE", name: "Ceará"), | |
| (uf: "DF", name: "Distrito Federal"), | |
| (uf: "ES", name: "Espírito Santo"), | |
| (uf: "GO", name: "Goiás"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Para CPF | |
| /^\d{3}\.\d{3}\.\d{3}\-\d{2}$/ | |
| fun main(args: Array<String>) { | |
| if (Regex("^\\d{3}\\.\\d{3}\\.\\d{3}\\-\\d{2}$").matches("000.000.000-00")) { | |
| println("sim") | |
| } else { | |
| println("não") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| brew install php71-intl | |
| brew tap kyslik/homebrew-php | |
| brew install kyslik/php/php71-intl | |
| brew install phplint (o que esta funcionando) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CustomDisableSwapViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { | |
| var enabled: Boolean? | |
| init { | |
| this.enabled = false | |
| } | |
| override fun onTouchEvent(event: MotionEvent): Boolean { | |
| return if (this.enabled!!) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Stop all constainers | |
| docker stop $(docker ps -a -q) | |
| # Delete all containers | |
| docker rm $(docker ps -a -q) | |
| # Delete all images | |
| docker rmi $(docker images -q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
| if segue.identifier == "meu_identificador" { | |
| if let destinationNavigationController = segue.destination as? UINavigationController, | |
| let targetController = destinationNavigationController.topViewController as? meu_controller { | |
| ... | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kapt { | |
| generateStubs = true | |
| } | |
| dependencies { | |
| ... | |
| compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | |
| compile 'com.google.dagger:dagger:2.0.2' | |
| kapt 'com.google.dagger:dagger-compiler:2.0.2' | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func viewWillAppear(animated: Bool) { | |
| animateTable() | |
| } | |
| func animateTable() { | |
| tableView.reloadData() | |
| let cells = tableView.visibleCells() | |
| let tableHeight: CGFloat = tableView.bounds.size.height | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OBS: O var_number_int é a varável que recebera o valor a ser convertido em DP | |
| (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, var_number_int, getResources().getDisplayMetrics()) | |
| ##KOTLIN | |
| val Int.dp: Int | |
| get() = (this * Resources.getSystem().displayMetrics.density + 0.5f).toInt() | |
| val Float.dp: Int |