Skip to content

Instantly share code, notes, and snippets.

View ArnaudLigny's full-sized avatar
👨‍💻
Solving problems

Arnaud Ligny ArnaudLigny

👨‍💻
Solving problems
View GitHub Profile
@ArnaudLigny
ArnaudLigny / website.yml
Created January 4, 2024 13:42
GitHub Action workflow: build & deploy a website with Cecil
name: Build & deploy website
on:
push:
branches: [master, main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
<?php
// build an inverted index
// https://en.m.wikipedia.org/wiki/Inverted_index
function buildInvertedIndex(array $filenames): array
{
$invertedIndex = [];
foreach($filenames as $filename) {
$data = file_get_contents($filename);
@ArnaudLigny
ArnaudLigny / tailwind-darkmode-toggle.html
Created February 10, 2022 09:24 — forked from sjones6/tailwind-darkmode-toggle.html
A darkmode toggle using tailwindcss
<div class="w-14 h-8">
<input type="checkbox" id="dark-mode-toggle" class="hidden" onchange="document.documentElement.classList.toggle('dark')" />
<label for="dark-mode-toggle" class="w-full h-full bg-gray-800 dark:bg-white rounded-full p-1 flex justify-between cursor-pointer">
<span class="inline dark:hidden">🌞</span>
<span class="w-6 h-6 rounded-full bg-white dark:bg-gray-800 block float-right dark:float-left"></span>
<span class="hidden dark:inline">🌛</span>
</label>
</div>
@ArnaudLigny
ArnaudLigny / composer.json
Last active November 6, 2021 02:37 — forked from 2bard/translation_notes
Using Symfony Translation component with Twig outside of Symfony.
{
"require": {
"symfony/translation": "^5.0",
"symfony/twig-bridge": "^5.0",
"symfony/yaml" : "^5.0",
"twig/twig": "^3.0"
}
}
@ArnaudLigny
ArnaudLigny / build.sh
Last active March 3, 2021 22:06
Cecil build script
# What this script do?
# 1. install Cecil if `cecil.phar` is not found (force a specific version with `CECIL_VERSION`)
# 2. install Composer if `composer.phar` is not found
# 3. install theme(s) if `composer.json` is found
# 4. run `php cecil.phar build -v`
if [ ! -f "./cecil.phar" ]; then
echo "Downloading Cecil"
if [ -z $CECIL_VERSION ]; then
curl -sSOL https://cecil.app/cecil.phar
@ArnaudLigny
ArnaudLigny / Git.php
Created November 13, 2020 22:10
Cecil/Util
<?php
/**
* This file is part of the Cecil/Cecil package.
*
* Copyright (c) Arnaud Ligny <arnaud@ligny.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@ArnaudLigny
ArnaudLigny / DynamicComparisons.php
Last active November 13, 2020 22:10
Cecil/Util
<?php
/**
* This file is part of the Cecil/Cecil package.
*
* Copyright (c) Arnaud Ligny <arnaud@ligny.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@ArnaudLigny
ArnaudLigny / twitch.js
Last active November 12, 2020 20:35
How To Block Twitch Ads
# https://ttv-ublock.vercel.app/twitch-videoad.js
const origFetch = window.fetch;
window.fetch = (url, init, ...args) => {
if (typeof url === "string") {
if (url.includes("/access_token")) {
// url = url.replace("player_type=site", "player_type=site");
} else if (
url.includes("/gql") &&
init &&
typeof init.body === "string" &&
@ArnaudLigny
ArnaudLigny / gh-pages-deploy.sh
Last active October 6, 2021 20:53
A bash script to deploy a static site on GitHub Pages.
#!/bin/bash -e
USER_NAME="Build Bot"
USER_EMAIL="build@domain.tld"
REPOSITORY="username/repository"
TARGET_BRANCH="gh-pages"
SITE_DIR="_site"
echo "Started deploy to $REPOSITORY/$TARGET_BRANCH"
@ArnaudLigny
ArnaudLigny / macos-keyboard-glyphs.md
Last active June 17, 2019 14:57
macOS Keyboard Glyphs

⌥ Option ⌃ Control ⇧ Shift ⌘ Command ⎋ Escape ⇪ Caps lock ⇥ Tab ⏏︎ Eject ⌫ Delete