Skip to content

Instantly share code, notes, and snippets.

View daformat's full-sized avatar

Mathieu Jouhet daformat

View GitHub Profile
@zwily
zwily / useFirebaseUpdater.js
Created March 10, 2019 20:56
Firebase throttled updater hook
import { useState, useRef } from "react";
import { useDocument } from "react-firebase-hooks/firestore";
import throttle from "lodash/throttle";
// Hook that gives you an updater function that will do throttled
// updates to a firebase document, and provide back to you views of
// the updated data (before it has persisted).
//
// arguments: a Document ref, and time in ms to throttle
// returns an object with following fields:
@daformat
daformat / utf-spaces.js
Last active October 25, 2023 08:19
A list of the different UTF spaces
utfSpaces = [
{
name: 'Space',
utf: '\u0020',
html: [' ', ' '],
breaking: true,
width: 'Typically 1/4 em',
unicode_category: 'Separator, Space',
matched_by_s_character_class: true
},
@crittermike
crittermike / wget.sh
Last active March 28, 2025 18:44
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@codeprimate
codeprimate / resize-gif.sh
Created January 27, 2016 00:27
Add Padding to an Animated GIF
convert loading.gif -coalesce -repage 0x0 -gravity center -extent 200x300 -background '#cccccc' +repage test1.gif
@niksumeiko
niksumeiko / git.migrate
Last active April 29, 2025 08:03
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE