Method | Side effects1 | State updates2 | Example uses |
---|---|---|---|
Mounting | |||
componentWillMount |
✓ | Constructor equivalent for createClass |
|
render |
Create and return element(s) | ||
componentDidMount |
✓ | ✓ | DOM manipulations, network requests, etc. |
Updating | |||
componentWillReceiveProps |
✓ | Update state based on changed props |
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
import android.app.Activity; | |
import android.content.Context; | |
import android.os.PowerManager; | |
import android.os.PowerManager.WakeLock; | |
import android.test.ActivityInstrumentationTestCase2; | |
/** | |
* This requires to be declared in the effective manifest: | |
* <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
* |
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 be.digitalia.common.widgets; | |
import android.content.Context; | |
import android.os.SystemClock; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.ProgressBar; | |
/** | |
* ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be |
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
inline fun SharedPreferences.edit(changes: SharedPreferences.Editor.() -> SharedPreferences.Editor) { | |
edit().changes().apply() | |
} | |
fun ImageView.tintSrc(@ColorRes colorRes: Int) { | |
val drawable = DrawableCompat.wrap(drawable) | |
DrawableCompat.setTint(drawable, ContextCompat.getColor(context, colorRes)) | |
setImageDrawable(drawable) | |
if (drawable is TintAwareDrawable) invalidate() // Because in this case setImageDrawable will not call invalidate() | |
} |
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
/** | |
* Remove acentos de caracteres | |
* @param {String} stringComAcento [string que contem os acentos] | |
* @return {String} [string sem acentos] | |
*/ | |
function removerAcentos( newStringComAcento ) { | |
var string = newStringComAcento; | |
var mapaAcentosHex = { | |
a : /[\xE0-\xE6]/g, | |
e : /[\xE8-\xEB]/g, |
use the build in sizes like @dimen/text_size_body_2_material
or style/TextAppearance.Material.Headline
.
Simple helper file for standard text sizes in material design. The sizes are provided by the material design documentation https://www.google.com/design/spec/style/typography.html#typography-roboto
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
PackageManager pm = getPackageManager(); | |
Intent main = new Intent(Intent.ACTION_MAIN, null); | |
main.addCategory(Intent.CATEGORY_LAUNCHER); | |
List<ResolveInfo> packages = pm.queryIntentActivities(main, 0); | |
ArrayList<String> app_name_list = new ArrayList<String>(); | |
ArrayList<String> app_package_list = new ArrayList<String>(); | |
for(ResolveInfo resolve_info : packages) { | |
try { |
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
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str) { | |
return str.toLowerCase(); |
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 | |
# options: | |
# remove stopped containers and untagged images | |
# $ dkcleanup | |
# remove all stopped|running containers and untagged images | |
# $ dkcleanup --reset | |
# remove containers|images|tags matching {repository|image|repository\image|tag|image:tag} | |
# pattern and untagged images | |
# $ dkcleanup --purge {image} |
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
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin master |