Skip to content

Instantly share code, notes, and snippets.

View sreucherand's full-sized avatar

Sylvain Reucherand sreucherand

View GitHub Profile
@sreucherand
sreucherand / macro.gs
Created May 11, 2023 10:01
Google Spreadsheet (gsheet), color a cell based on its value (adds a Color menu).
const REGEX_RGBA = /^rgba\(([\d]{1,3}),\s*([\d]{1,3}),\s*([\d]{1,3}),\s*(0|1(?:\.0+)?|0\.\d+)\)$/
const REGEX_RGB = /^rgba\(([\d]{1,3}),\s*([\d]{1,3}),\s*([\d]{1,3})\)$/
const REGEX_HEX = /^#([\da-zA-Z]{3}|[\da-zA-Z]{6})$/
function onOpen() {
const ui = SpreadsheetApp.getUi();
const menu = ui.createMenu("Color");
menu.addItem("Set cell background color from content", "setCellBackgroundColorFromContent");
menu.addToUi();
@sreucherand
sreucherand / extract.js
Created October 28, 2020 09:46
Extract all named modules into one aggregated file from a export * entry file
const fs = require('fs')
const path = require('path')
const regex = /export (.*) from '([^']+)'/
const browse = filepath => {
const content = fs.readFileSync(filepath).toString()
const matches = content.match(new RegExp(regex, 'g'))
if (!matches) {
@sreucherand
sreucherand / Vagrantfile
Created December 28, 2019 10:55
Vagrantfile synced_folder configuration for webserver
Vagrant.configure("2") do |config|
config.vm.synced_folder "./local", "/distant", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]
end
@sreucherand
sreucherand / provision.sh
Created December 28, 2019 10:52
Bootstrap Kirby CMS with Vagrant — Ubuntu Xenial 16.04
# Packages
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2 curl git libapache2-mod-php7.3 php7.3 php7.3-ctype php7.3-curl php7.3-mbstring php7.3-gd php7.3-zip unzip
# Composer
sudo mkdir -p -m 775 /usr/local/bin
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
@sreucherand
sreucherand / README.md
Last active June 24, 2019 13:02
Hyper tuning

Zsh

brew install zsh

Tldr

brew install tldr
<!-- ios standalone web app -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- ios status bar appearance, options: black, black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- ios icon, just one size because ios will scale it, remove "-precomposed" if you want ios to add effects -->
<link href="icon@144x144.png" sizes="144x144" rel="apple-touch-icon-precomposed">
<!-- ios startup images -->