Skip to content

Instantly share code, notes, and snippets.

View Liroo's full-sized avatar
📟
Make The Internet Great Again.

Liroo Pierre ᵈᵉᵛ Liroo

📟
Make The Internet Great Again.
View GitHub Profile
@Liroo
Liroo / relate.js
Created October 30, 2019 15:11
Use of javascript Proxy for a new object relational concept in Javascript.
let _instanceRelateDb = null;
class RelateDb {
constructor() {
if (_instanceRelateDb) { return _instanceRelateDb; }
_instanceRelateDb = this;
this._db = {};
}
@Liroo
Liroo / usePersistReducer.js
Last active January 22, 2020 09:47
Really simple react hook for persistant reducer across session.
import { useReducer } from 'react';
export const usePersistReducer = (reducer, initialState, key) => {
let persistKey = `__PERSIST_REDUCER_${key}__`
const persistReducer = (state, action) => {
let newState = reducer(state, action);
localStorage.setItem(persistKey, JSON.stringify(newState));
return newState;
<?php
defined('ABSPATH') || exit;
class _FP_Nav {
public static $nav = false;
public static $instance = null;
function __construct() {
self::$instance = $this;
@Liroo
Liroo / barba_namespace.php
Last active June 16, 2019 22:48
Find the best Barba namespace for your wordpress theme.
<?php
$barbaNamespace = '';
$post_type = get_post_type();
switch ($post_type) {
case 'page':
$barbaNamespace = get_query_var('pagename');
if ( !$barbaNamespace && $id > 0 ) {
// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
@Liroo
Liroo / test.php
Last active March 9, 2017 04:52
test
<?php
$descFic = fopen ("/etc/passwd", "r");
while ($ligne = fread ($descFic, filesize("/etc/passwd")))
{
echo $ligne;
}
?>