Skip to content

Instantly share code, notes, and snippets.

View fabricethilaw's full-sized avatar

Fabrice Thilaw fabricethilaw

View GitHub Profile
@fabricethilaw
fabricethilaw / Printable Content Test
Created June 29, 2023 14:10
Add your image in comments to get their downloadable link.
// Add your image in comments to get their downloadable link.
# Hôte virtuel par défaut
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName monsite.local
DocumentRoot /var/www/html
ErrorLog /var/www/log/error.log
CustomLog /var/www/log/access.log combined
</VirtualHost>
<VirtualHost *:80> a2dissite default
ServerAdmin [email protected]
.addHeader("Authorization", "Bearer " + PrefUtils.getToken().orEmpty())
//.addHeader("Accept-Language", PrefUtils.getLanguage()!!)
.addHeader("Device-OS", "android")
.addHeader("App-Source", "com.achabi.distributors")
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("X-Achabi-App", "Distributor")
/**
* * New version: 30/May/2017
* * Made it more kotlin-like with same functionality ^^
*
* based on: https://gist.github.com/RomansBermans/6f3836188427fbd3b1efcf7e6418f06d
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
@fabricethilaw
fabricethilaw / generate-pushid.js
Created July 5, 2017 09:06 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@fabricethilaw
fabricethilaw / ClickableTextView.java
Created January 13, 2017 11:28 — forked from dafi/ClickableTextView.java
Android TextView changing color when clicked. It uses the setSelect(); to change color. Show how to change text color and background
package com.ternaryop.phototumblrshare.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.TextView;
public class ClickableTextView extends TextView implements OnTouchListener {