Skip to content

Instantly share code, notes, and snippets.

View wilomgfx's full-sized avatar
🧙‍♂️
Focus pocus

William Cantin wilomgfx

🧙‍♂️
Focus pocus
View GitHub Profile
import { useEffect } from 'react';
const importScript = resourceUrl=> {
useEffect(() => {
const script = document.createElement('script');
script.src = resourceUrl;
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
}
@wilomgfx
wilomgfx / matches-without-substring
Created July 9, 2019 19:49
Regex that matches sentence without substring
^((?!substring).)*$
@wilomgfx
wilomgfx / restore.sh
Created January 26, 2019 22:13 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@wilomgfx
wilomgfx / install-psycopg2-venv-macso.sh
Created January 26, 2019 20:46 — forked from geekforbrains/shell.sh
Installing psycopg2 in virtualenv on macOS Sierra
$ xcode-select --install
$ brew install openssl
$ virtualenv env
$ . env/bin/activate
$(env) env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
This file has been truncated, but you can view the full file.
ft outer join webflix.acteur acteur2_ on this_.acteurid=acteur2_.acteurid inner join webflix.film film3_ on this_.filmid=film3_.filmid left outer join webflix.realisateur realisateu4_ on film3_.realisateurid=realisateu4_.realisateurid where this_.personnageid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2018-10-23 19:06:30.770 DEBUG 80870 --- [ entityloader-1] org.hibernate.SQL : select this_.personnageid as personnageid1_13_3_, this_.acteurid as acteurid3_13_3_, this_.filmid as filmid4_13_3_, this_.nom as nom2_13_3_, acteur2_.acteurid as acteurid1_0_0_, acteur2_.biographie as biographie2_0_0_, acteur2_.datenaissance as datenaissance3_0_0_, acteur2_.lieunaissance as lieunaissance4_0_0_, acteur2_.nom as nom5_0_0_, acteur2_.prenom as prenom6_0_0_, film3_.filmid as filmid1_5_1_, film3_.anneessortie as anneessortie2_5_1_, film3_.langueoriginale as langueoriginale3_5_1_, film3_.nbcopie as nbcopie4_5_1_, film3_.realisateurid as realisateurid7_5_1_, film3_.resumescenario as resumescenario5_5_1_, film3_.t
@wilomgfx
wilomgfx / chmod a file on windows
Created July 9, 2018 18:10
How to chmod on windows so that git sees the changes !
First you need to add the file (stage) then
git update-index --chmod=+x file_name
//For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:
// First method (override Material UI classnames):
// 1 - Add the property classes in the AppBar component:
<AppBar classes={{root: 'my-root-class'}}
// 2 - Override the styles with the styled components:
styled(AppBar)`
&.my-root-class {
z-index: 1500;
}
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408,
"Blue Component" : 1
},
@wilomgfx
wilomgfx / genesis_public_key
Created February 26, 2018 20:39
genesis_public_key
048b67174c7dcfe2da7a570f9929f7194c450a58a67ff0360be2a0520b95cd743b749a99f6227eb5ee3647818125e6ebdcd480d9edabbc17b63420f613937ee171
const user = {name: 'Shivek Khurana', age: 23, password: 'SantaCl@use'};
const userWithoutPassword = Object.keys(user)
.filter(key => key !== 'password')
.map(key => ({[key]: user[key]}))
.reduce((accumulator, current) =>
({...accumulator, ...current}),
{}
)
;
// userWithoutPassword becomes {name: 'Shivek Khurana', age: 23}