Skip to content

Instantly share code, notes, and snippets.

View adriengibrat's full-sized avatar
:octocat:
open sourcing when not too busy

Adrien Gibrat adriengibrat

:octocat:
open sourcing when not too busy
View GitHub Profile
@adriengibrat
adriengibrat / l.php
Last active January 22, 2024 14:45
Extreme minification of shortest possible PSR-0 compliant autoloader, 5 lines !
<?php
//set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); // optional
spl_autoload_register(function ($class) {
$file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
if (stream_resolve_include_path($file))
require $file;
});
https://github.com/CaoKha/tenisu-app
+ playwright (getByRole)
+ vite / vitest: template ?
+ vercel <3
+ minimal css global (:root / variables / fontfaces)
? tenis-card: onClick -> Link router, className ?, css-in-js vs css variables DX (autocomplete?)
? searchbar.spec: filterPlayer = pure -> test without duplication, use import, refactor to use store
? store: context <3, API low level, why not move app logic to context?
? detailPage: DRY components, Architecture refactor: embed API call or data retrieval (refresh error message is a limitation)
@import url('https://fonts.googleapis.com/css?family=Roboto');
button {
cursor: pointer;
}
@adriengibrat
adriengibrat / bower.json
Last active March 13, 2022 00:39
Parse ISO 8601 duration as function that sums duration to a given date
{
"name": "parseDuration",
"version": "0.0.1",
"main": "./parseDuration.es5.js"
}
#[...]
# Default language to English
export LANG=en_US.UTF-8
export LANGUAGE=en_US
export LC_ALL=en_US.UTF-8
#export LC_MESSAGES=en_US
#export LC_MESSAGES=C
# GIT PS1 FTW
@adriengibrat
adriengibrat / Object.prototype.watch.js
Last active April 23, 2020 19:24
Object.prototype.watch "polyfill"
/**
* Object.prototype.watch polyfill
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch
*
* Known limitations:
* - `delete object[property]` will remove the watchpoint
*
* Based on Eli Grey gist https://gist.github.com/eligrey/384583
* Impovements based on Xose Lluis gist https://gist.github.com/XoseLluis/4750176
* This version is optimized for minification
@adriengibrat
adriengibrat / skiff.armbian9.next.log
Last active February 15, 2018 11:15
Skiff odroid ux4 compile error
>>> skeleton-init-common Fixing libtool files
>>> skeleton-init-common Installing to target
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' system/skeleton/ /media/myCloudDrive/SkiffOS/workspaces/default/target/
/usr/bin/install -d -m 0755 /media/myCloudDrive/SkiffOS/workspaces/default/target/bin
/usr/bin/install -d -m 0755 /media/myCloudDrive/SkiffOS/workspaces/default/target/sbin
/usr/bin/install -d -m 0755 /media/myCloudDrive/SkiffOS/workspaces/default/target/lib
ln -snf lib /media/myCloudDrive/SkiffOS/workspaces/default/target/lib32
ln -snf lib /media/myCloudDrive/SkiffOS/workspaces/default/target/usr/lib32
/usr/bin/install -m 0644 support/misc/target-dir-warning.txt /media/myCloudDrive/SkiffOS/workspaces/default/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
>>> skeleton-init-sysv Extracting
@adriengibrat
adriengibrat / plural.js
Last active May 30, 2017 08:14
simple CLDR plural rules parser
#!/usr/bin/env node
/**
* plural.js – simple CLDR plural rules parser
* https://gist.github.com/adriengibrat/817140a89cfd4893b4155a2ac913904d
*
* This program is free software. It comes without any warranty.
* Released under the WTFPL license – http://www.wtfpl.net
*
* Usage:
@adriengibrat
adriengibrat / messageformat.js
Last active July 20, 2016 07:15
messageformat with format & debug
var mf = (function () {
'use strict';
function warn () {
/* eslint no-console: off, prefer-spread: off */
console.warn.apply(console, arguments)
}
function error (message) {
/* eslint no-var: off */
@adriengibrat
adriengibrat / fiddle.html
Last active July 5, 2016 23:57 — forked from jed/LICENSE.txt
isSameOrigin
Page url: <span id="location"></span>
<div>
<span class="url">http://fiddle.jshell.net</span> <span>true</span></div>
<div><span class="url">http://fiddle.jshell.net:80</span> <span>true</span></div>
<div><span class="url">//fiddle.jshell.net</span> <span>true</span></div>
<div><span class="url">//fiddle.jshell.net:80</span> <span>true</span></div>
<div><span class="url">http://fiddle.jshell.net:81</span> <span>false</span></div>
<div><span class="url">https://fiddle.jshell.net</span> <span>false</span></div>