Skip to content

Instantly share code, notes, and snippets.

View raphaelbussa's full-sized avatar
💻
Working from anywhere

Raphaël Bussa raphaelbussa

💻
Working from anywhere
View GitHub Profile
@raphaelbussa
raphaelbussa / SectionAdapter.kt
Last active February 12, 2019 18:04
SectionAdapter
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
abstract class SectionAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val headerPositions: MutableMap<Int, Int> = mutableMapOf()
private val itemPositions: MutableMap<Int, Int> = mutableMapOf()
private val sectionItemPositions: MutableMap<Int, Int> = mutableMapOf()
private var listSize = 0
private var headerSize = 0
@Throws(Exception::class)
fun Realm.exportDatabase(context: Context) {
val path = "${Environment.getExternalStorageDirectory().path}/${this.configuration.realmFileName}"
val file = File(path)
if (file.exists()) {
file.delete()
}
this.writeCopyTo(file)
this.close()
val uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file)
@raphaelbussa
raphaelbussa / Provincie.swift
Last active February 17, 2019 19:00
provincie italiane swift enum
enum Provincie: String {
static let allCases: [Provincie] = [
AG,
AL,
AN,
AO,
AR,
AP,
AT,
AV,
enum Comuni: String {
static let allCases: [Comuni] = [
abanoterme,
abbadiacerreto,
abbadialariana,
abbadiasansalvatore,
abbasanta,
abbateggio,
abbiategrasso,
abetone,
enum Regioni: String, PostgreSQLRawEnum {
static let allCases: [Regioni] = [
abruzzo,
basilicata,
calabria,
campania,
emiliaromagna,
friuliveneziagiulia,
lazio,
liguria,
@raphaelbussa
raphaelbussa / install.sh
Created February 20, 2019 16:44 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`