Skip to content

Instantly share code, notes, and snippets.

View GiorgioNatili's full-sized avatar

Giorgio Natili GiorgioNatili

View GitHub Profile
@GiorgioNatili
GiorgioNatili / waitUntilCreated.kt
Created April 21, 2018 16:28
Wait until a fragment is created and execute a lambda with the fragment as an argument.
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 March 5, 2018 06:56
Run a lambda only when the objects don't contain a null property
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 {

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:

<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 June 7, 2017 20:21
NG2 Tests Useful Links
## 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 December 17, 2016 00:03 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#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.