Skip to content

Instantly share code, notes, and snippets.

View dimitrinicolas's full-sized avatar

Dimitri Nicolas dimitrinicolas

View GitHub Profile
{
"input": "assets",
"output": "assets/output",
"watch": true,
"filters": [
{
"glob": "**/*.*",
"use": [
{
"name": "lepto.jpeg",
<img srcset="assets/output/icon.png,
assets/output/icon@2x.png 2x,
assets/output/icon@3x.png 3x"
src="assets/output/icon.png" alt="Icon alt">
@dimitrinicolas
dimitrinicolas / 001.jpg
Last active May 20, 2019 20:48
Some ordinary resources for lazy tester of Lepto, download them with the Download ZIP button upright. Article: https://dev.to/dimitrinicolas/learn-how-to-automate-your-image-optimization-process-with-lepto-890
001.jpg
@dimitrinicolas
dimitrinicolas / umatrix-rules.txt
Last active December 31, 2023 09:11
uMatrix Rules
# (c) Dimitri NICOLAS
# LICENSED UNDER MIT
https-strict: * true
https-strict: behind-the-scene false
matrix-off: about-scheme true
matrix-off: behind-the-scene true
matrix-off: chrome-extension-scheme true
matrix-off: chrome-scheme true
matrix-off: moz-extension-scheme true
@dimitrinicolas
dimitrinicolas / page.jsx
Last active November 23, 2019 12:20
How to get reCaptcha on multiple Gatsby pages
import React from 'react';
import { Helmet } from 'react-helmet';
import { REACAPTCHA_PUBLIC } from '../config';
const Page = () => {
return (
<React.Fragment>
<Helmet>
<script src={`https://www.google.com/recaptcha/api.js?r=${Math.random()}`} async defer></script>
@dimitrinicolas
dimitrinicolas / notify.ts
Last active February 6, 2019 18:00
Telegram and SMS notifier module
import fetch from 'node-fetch';
import twilio from 'twilio';
const {
NOTIFICATION_PREFIX,
TELEGRAM_CHAT_ID,
TWILIO_ACCOUNT_SID,
TWILIO_FROM_NUMBER,
TWILIO_TO_NUMBER
} = require('../../../config');
@dimitrinicolas
dimitrinicolas / README.md
Last active December 18, 2023 11:42
Handle mouse down/up and click events once with React Hooks

Handle mouse down/up and click events once with React Hooks

The issue

Sometimes you need to make a button clickable with click and mouse down or mouse up actions.

The first solution that comes to mind would be to add only one event listener onMouseDown/onMouseUp but without an onClick event listener the element is not accessible anymore. It's now hard to click for people with disabilities or with keyboard navigation.

If we set both onMouseDown/onMouseUp and onClick event listeners, the common click handler function would be called twice with a mouse. So we have

@dimitrinicolas
dimitrinicolas / _document.js
Last active September 6, 2022 19:06
Custom Next.js Document for basic html "lang" property setting according to the page path
import Document, { Head, Main, NextScript } from 'next/document';
import React from 'react';
const LANGUAGES = ['fr', 'en'];
class MyDocument extends Document {
render() {
const pathPrefix = this.props.__NEXT_DATA__.page.split('/')[1];
const lang =
@dimitrinicolas
dimitrinicolas / README.md
Last active May 27, 2019 20:30
Express Application with Passport session reading with Socker.io
@dimitrinicolas
dimitrinicolas / README.md
Last active April 4, 2021 08:52
My repositories, indexed

My repositories, indexed

Front-end modules

  • skeleton-screens-concept - A Skeleton Screens implementation for SPA first load in CSS
  • overflow-color - Automatically switch css html background color to bring a smooth user experience
  • semantic.css - Classless CSS framework for building quick semantic HTML pages prototypes
  • use-mouse-action - React Hooks to listen to both mouse down or up and click events with a once called function

Node.js modules