Skip to content

Instantly share code, notes, and snippets.

@nikhilmufc7
nikhilmufc7 / auth.dart
Last active July 10, 2024 08:26
Firebase Flutter Platform Exception Codes and example
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
@kobeumut
kobeumut / HashUtils.kt
Created October 25, 2017 14:22
I found Sam Clarke's kit. SHA 512 etc.
package com.samclarke.android.util
import java.security.MessageDigest
/**
* Hashing Utils
* @author Sam Clarke <www.samclarke.com>
* @license MIT
*/
object HashUtils {
@kobeumut
kobeumut / kotlin-Restriction-Vetoable.kt
Last active October 3, 2017 13:25
if you only want to use within your restriction you use vetoable
//if you only want to use within your restriction you use vetoable
var name by vetoable("adali") { property: KProperty<*>, oldValue, newValue ->
newValue.startsWith("A")
}
name = "umut"
// # : name = "adali" ->because name not startwith S so
name = "Adanalı"
// # : name = "adanali" -> that's it
@kobeumut
kobeumut / hideKeyboard.kt
Created August 21, 2017 07:06
Close opened keyboard on Android programatically
//For Kotlin
val inputManager:InputMethodManager =getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.hideSoftInputFromWindow(currentFocus.windowToken, InputMethodManager.SHOW_FORCED)
//For Java
InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.SHOW_FORCED);
@kobeumut
kobeumut / MultiDexSample.java
Last active August 25, 2017 07:03
MultiDex Error
android {
...
defaultConfig {
multiDexEnabled true
...
}
}
dependencies {
// add dependency
@kobeumut
kobeumut / UnabletoAddWindow.java
Created August 11, 2017 08:50
This is a common problem, you can not reach the context first and therefore it is null. What you need to do here is that if you use "ActivityName.this" instead of getApplicationContext(), context etc. your problem will be resolved.
/*
This is a common problem, you can not reach the context first and therefore it is null.
What you need to do here is that if you use "ActivityName.this" instead of getApplicationContext(),
context etc. your problem will be resolved.
*/
//For example Alert Dialog;
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this); //Activity name
alertDialog.setMessage("Test Messages");
alertDialog.setPositiveButton("OK", listener);
AlertDialog alert = alertDialog.create();
@kobeumut
kobeumut / UiThreadExample.java
Last active August 25, 2017 07:03
thread that has not called Looper.prepare() Android Error
runOnUiThread(new Runnable() {
public void run() {
//Your code is in here
}
});
@codediodeio
codediodeio / database.rules.json
Last active July 24, 2024 21:05
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@daniellevass
daniellevass / android_material_design_colours.xml
Last active June 5, 2024 13:54
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@staltz
staltz / introrx.md
Last active July 26, 2024 04:24
The introduction to Reactive Programming you've been missing