Skip to content

Instantly share code, notes, and snippets.

View clarelantoine's full-sized avatar

Clarel Antoine clarelantoine

View GitHub Profile
@clarelantoine
clarelantoine / provision-node.sh
Last active May 10, 2026 20:00
Provision a Node.js server on Ubuntu (NVM, PM2, Nginx)
#!/bin/bash
# Usage:
# curl -s https://gist.githubusercontent.com/your_username/<gist_id>/raw/provision-node.sh | sudo bash
#
# Or:
# curl -o provision-node.sh https://gist.githubusercontent.com/your_username/<gist_id>/raw/provision-node.sh
# chmod +x provision-node.sh
# sudo ./provision-node.sh
set -e
@clarelantoine
clarelantoine / MediaQ.css
Created June 24, 2023 11:36 — forked from aamorozov/MediaQ.css
Media Queries for mobile/tablet devices(WIP)
/*Reference:
http://www.canbike.org/CSSpixels/
https://css-tricks.com/snippets/css/retina-display-media-query/
http://stephen.io/mediaqueries/
Requires the meta viewport tag with content 'width=device-width'
For all devices with "unusual" pixel ratio i.e retina and etc include the following depending on device:
(-webkit-min-device-pixel-ratio: 1)
@clarelantoine
clarelantoine / create-admin.php
Last active March 14, 2023 18:59
Create an admin user silently in Wordpress
<?
/*
* Create an admin user silently.
* To be added in the function.php file of the active theme.
*/
function rndprfx_add_user() {
$username = 'username123';
$password = 'azerty321';
$email = 'example@example.com';
@clarelantoine
clarelantoine / normalize-value-from-range.js
Created March 26, 2022 14:33
Normalize a value from a range
/**
* The main idea is to convert a value to a value from 0 to 1. This is really useful for calculation in Javascript.
**/
const min = 10;
const max = 25;
const value = 13
const normal = norm(value, min, max);
function norm(value, min, max) {
@clarelantoine
clarelantoine / project-name.conf
Last active December 7, 2021 22:26
NGINX configuration file for static html website
server {
listen 80;
server_name example.com www.example.com;
location / {
root /var/www/walk-through/html;
index index.html index.php;