View .vimrc
This file contains 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
" remap escape key to jk | |
imap jk <Esc> | |
" when possible cursor is in center of screen | |
nnoremap j jzz | |
nnoremap k kzz | |
nnoremap `` ``zz | |
" general settings | |
set rnu et ts=4 sw=4 sts=4 ai cindent nowrap noswapfile cursorline splitbelow splitright |
View longs_and_dates.kt
This file contains 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
fun convertLongToTime(time: Long): String { | |
val date = Date(time) | |
val format = SimpleDateFormat("yyyy.MM.dd HH:mm") | |
return format.format(date) | |
} | |
fun currentTimeToLong(): Long { | |
return System.currentTimeMillis() | |
} |
View hide_keyboard.kt
This file contains 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
// In your Activity or Fragment create a function as: | |
fun View.hideKeyboard() { | |
val inputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
inputManager.hideSoftInputFromWindow(windowToken, 0) | |
} | |
// suppose you have a button with an id your_button_id in XML file related to this Activity or Fragment, so, on button click event: | |
your_button_id.setOnClickListener{ |
View valid_date_android.kt
This file contains 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
// Configure o SimpleDateFormat no onCreate ou onCreateView | |
String pattern = "dd/MM/yyyy"; | |
SimpleDateFormat sdf = new SimpleDateFormat(pattern); | |
sdf.setLenient(false); | |
// Durante a confirmacao de cadastro, faça a validacao | |
String data = NascimentoUsu.getText().toString(); |
View installing_python_enviroments.sh
This file contains 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
#!/bin/bash | |
# Step 1: | |
# Install venv | |
sudo apt install -y python3-venv | |
# Step 2: | |
# Install depedencies | |
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git | |
# Step 3: |
View MaskBrMonetaryValue.kt
This file contains 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
package br.uea.transirie.mypay.mylaundry.util | |
import android.text.Editable | |
import android.text.TextWatcher | |
import android.widget.EditText | |
class MaskBrMonetaryValue { | |
companion object { | |
fun mask(editableText: EditText): TextWatcher { | |
return object : TextWatcher { |
View script_download_wordlist.js
This file contains 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
// https://www.dicio.com.br/lista-de-palavras/ | |
function download(filename, text) { | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); |
View save_file_on_console_javascript.js
This file contains 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
function download(filename, text) { | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); |
View search_toolbar_in_android.kt
This file contains 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 fun onCreateOptionsMenu(menu: Menu): Boolean { | |
// Inflate layout menu | |
menuInflater.inflate(R.menu.menu_historico, menu) | |
// Initialize menu item | |
val menuItem: MenuItem = menu.findItem(R.id.search_view) | |
// Initialize search view | |
val searchView: SearchView = getActionView(menuItem) as SearchView | |
searchView.setOnQueryTextListener ( object : SearchView.OnQueryTextListener { | |
override fun onQueryTextChange(newText: String): Boolean { |
View android_init_activity_start.kt
This file contains 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
Handler().postDelayed({ | |
startActivity(Intent(this, Activity::class.java)) | |
}, 2000) |
NewerOlder