Skip to content

Instantly share code, notes, and snippets.

View luisenricke's full-sized avatar

Luis Villalobos luisenricke

View GitHub Profile
@luisenricke
luisenricke / BaseActivity.kt
Created February 4, 2020 18:22
Android: hide keyboard
@Suppress("unused")
abstract class BaseActivity : AppCompatActivity() {
private lateinit var inputMethodManager: InputMethodManager
...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
@luisenricke
luisenricke / sha_aes_utility.kt
Created October 9, 2019 05:25 — forked from reuniware/sha_aes_utility.kt
Android Kotlin : SHA-1 Hash and AES Encryption/Decryption and Storing password, secretKey, IV and Hash in Shared Preferences
fun hashAndSavePasswordHash(context: Context, clearPassword: String) {
val digest = MessageDigest.getInstance("SHA-1")
val result = digest.digest(clearPassword.toByteArray(Charsets.UTF_8))
val sb = StringBuilder()
for (b in result) {
sb.append(String.format("%02X", b))
}
val hashedPassword = sb.toString()
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context)
val editor = sharedPref.edit()
@luisenricke
luisenricke / buildApp.gradle
Created October 1, 2019 20:20
GradleFasterBuild
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
defaultConfig {
...
//See more in: https://source.android.com/devices/tech/dalvik
multiDexEnabled true
...
@luisenricke
luisenricke / DeployHerokuLaravelBlog.md
Last active June 15, 2019 19:41
Ejemplo de como deployar en Heroku un proyecto de Laravel

git clone git@github.com:jcc/blog.git && cd \ && composer install && npm install
cp .env.example .env
Cambiar la paqueteria de fzaninotto/faker a requerido
fzaninotto/faker
composer update && npm run production
echo web: vendor/bin/heroku-php-apache2 public/ > Procfile
Eliminar las cosas de gitignore
heroku create
heroku buildpacks:add heroku/php
php artisan key:generate --show