Skip to content

Instantly share code, notes, and snippets.

View francoisgeorgy's full-sized avatar

François Georgy francoisgeorgy

View GitHub Profile
@francoisgeorgy
francoisgeorgy / limitLoop.js
Created September 9, 2020 11:14 — forked from addyosmani/limitLoop.js
Limit the frame-rate being targeted with requestAnimationFrame
/*
limitLoop.js - limit the frame-rate when using requestAnimation frame
Released under an MIT license.
When to use it?
----------------
A consistent frame-rate can be better than a janky experience only
occasionally hitting 60fps. Use this trick to target a specific frame-
rate (e.g 30fps, 48fps) until browsers better tackle this problem
@francoisgeorgy
francoisgeorgy / .eleventy.config.js
Last active December 2, 2023 14:31 — forked from danielpost/.eleventy.config.js
Eleventy: Purge CSS for each html file #11ty
const { PurgeCSS } = require('purgecss');
/**
* Remove any CSS not used on the page and inline the remaining CSS in the
* <head>.
*
* @see {@link https://github.com/FullHuman/purgecss}
*/
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => {
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) {
@francoisgeorgy
francoisgeorgy / jquery-es6-example.md
Created March 23, 2020 13:16 — forked from mgol/jquery-es6-example.md
jQuery ES6 modules example usage

jQuery source is now authored using ES6 modules. It's possible to use them directly in the browser without any build process.

To test it locally, first clone the jQuery repository:

git clone git@github.com:jquery/jquery.git

Then, write the following index.html file:

@francoisgeorgy
francoisgeorgy / note-to-freq.js
Last active March 22, 2020 09:40 — forked from stuartmemo/Note to Frequency
convert note to frequency #music
// Takes string of Note + Octave
// Example:
// var frequency = getFrequency('C3');
var getFrequency = function (note) {
var notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'],
octave,
keyNumber;
if (note.length === 3) {
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@francoisgeorgy
francoisgeorgy / longest_common_substring.php
Created June 11, 2016 06:55 — forked from chrisbloom7/longest_common_substring.php
Find the longest common substring in an array of strings (PHP)
<?php
function longest_common_substring($words)
{
$words = array_map('strtolower', array_map('trim', $words));
$sort_by_strlen = create_function('$a, $b', 'if (strlen($a) == strlen($b)) { return strcmp($a, $b); } return (strlen($a) < strlen($b)) ? -1 : 1;');
usort($words, $sort_by_strlen);
// We have to assume that each string has something in common with the first
// string (post sort), we just need to figure out what the longest common
// string is. If any string DOES NOT have something in common with the first
// string, return false.
@francoisgeorgy
francoisgeorgy / springer-free-maths-books.md
Created December 29, 2015 07:46 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@francoisgeorgy
francoisgeorgy / sanitize.sh
Last active March 22, 2020 09:37 — forked from MoriTanosuke/sanitize.sh
clean filenames #shell
#!/bin/bash
#
# Sanitizes all files in the given path
# and makes them lowercase too.
#
# param 1: source directory
# param 2: target directory
shopt -s extglob;