Skip to content

Instantly share code, notes, and snippets.

@rsuper
rsuper / ViewTouchSharing.kt
Last active June 27, 2022 14:28
Share click and touch events over multiple views for Android
import android.view.View
object ViewTouchSharing {
fun shareTouchEvents(vararg views: View, clickListener: (() -> Unit)? = null) {
views.firstOrNull()?.let { view ->
view.setOnClickListener {
clickListener?.invoke()
}
}
@rsuper
rsuper / aws-fpm-nginx-installation.md
Last active February 5, 2019 09:50
AWS install PHP FPM 7.2 with nginx

Server installation

Short manual on how to configure the server, so all instances are the same:

  • PHP FPM
  • nginx
  • SSL configuration
  • port configuration
  • Uses the public folder for Symfony projects, modify paths to suit your needs
  • MySQL
@rsuper
rsuper / stream_to_youtube.sh
Created December 6, 2018 14:18 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@rsuper
rsuper / zipper.php
Last active October 24, 2018 13:02
PHP 'zip' arrays, like a zipper effect.
// Suppose you have 2 array and you want each value from array 2 to appear next to the value of array 1 with the same index...
$array1 = ['This', 'supposed', 'make', 'sentence'];
$array2 = ['is', 'to', 'a'];
$num1 = (count($array1) - 1) * 2;
$num2 = (count($array2) - 0) * 2;
$leftIndex = $num1 > 0 ? range(0, $num1, 2) : [0];
$rightIndexes = $num2 > 2 ? range(1, $num2, 2) : [1];
@rsuper
rsuper / install-apache24-php71.sh
Last active January 16, 2018 11:04
Mac OS Homebrew Apache 2.4 & PHP 7.1
#
# Installing Apache 2.4 and PHP 7.1 using Homebrew
# Credits @ https://gist.github.com/DragonBe/0faebe58deced34744953e3bf6afbec7
#
# Note to self to manage httpd process:
# sudo brew services start|stop|restart httpd
# Install Xcode command line tools
xcode-select --install
@rsuper
rsuper / compare.js
Created September 26, 2017 08:14
Expand all lines in a compare
i=setInterval(()=>{(l=document.querySelectorAll('.diff-expander')).forEach(e=>{e.click()});l.length?{}:clearInterval(i)},1000);