Skip to content

Instantly share code, notes, and snippets.

Giorgio Natili GiorgioNatili

Block or report user

Report or block GiorgioNatili

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@GiorgioNatili
GiorgioNatili / waitUntilCreated.kt
Created Apr 21, 2018
Wait until a fragment is created and execute a lambda with the fragment as an argument.
View waitUntilCreated.kt
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleObserver
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.OnLifecycleEvent
import android.support.v4.app.Fragment
inline fun <reified T : Fragment>Fragment.waitUntilCreated(crossinline callback: (T) -> Unit) {
val activationObject: LifecycleOwner = this
object : LifecycleObserver {
init {
@GiorgioNatili
GiorgioNatili / whenNotNullObjects.kt
Last active Mar 5, 2018
Run a lambda only when the objects don't contain a null property
View whenNotNullObjects.kt
package io.a2xe.experiments.selfielifecycle.utilities
/**
* Created by giorgio on 3/4/18.
*/
fun <T:Any> whenNotNullObjects(vararg args: T?, action: () -> Unit) {
args.forEach {target ->
checkNotNull(target) {
target!!::class.java.declaredFields.forEach {
View Italia-web-contributing.md

Contributing to Italia Web

This repository uses two main branches: develop and master. The first one is the one you should use to work on a new feature, even more, it's the one that we use on a daily base to commit and discuss our work. The second one is the one we cut from develop every time that we reach a milestone. You should use master as the base branch of pre-release or production bug fixes.

Create a Branch

Whenever you begin work on a new feature or bugfix, it's important that you create a new branch from develop or master; particularly, you should create a new branch from master only to fix issues identified in production or in the pre-production environment. Not only is it proper git workflow, but it also keeps your changes organized and separated from the master branch so that you can easily submit and manage multiple pull requests for every task you complete.

To create a new branch and start working on it:

View privacy.html
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@GiorgioNatili
GiorgioNatili / tdd_links.md
Created Jun 7, 2017
NG2 Tests Useful Links
View commits-merge
## Pull Request Merging Strategies and Commit Messages
The GIT history is a precious source of information and documentation, the aim of the outlined practices is to keep it more readable and rich of information.
### Branch Naming Convention and Practices
Every branch name should start with the JIRA ticket if the feature is not associated with
a JIRA ticket it can be omitted.
It's strongly recommended to push changes on a daily base; this will help the rest of the team understanding what's going on with the development.
@GiorgioNatili
GiorgioNatili / gist:a0b09801ab5763f807848e5beb142c76
Last active Dec 17, 2016 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1
View gist:a0b09801ab5763f807848e5beb142c76

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

You can’t perform that action at this time.