Skip to content

Instantly share code, notes, and snippets.

View bblanchon's full-sized avatar
🌟
No more counting dollars we’ll be counting stars

Benoît Blanchon bblanchon

🌟
No more counting dollars we’ll be counting stars
View GitHub Profile
@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active March 19, 2024 08:29
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
@fabianoriccardi
fabianoriccardi / benchmark-json-messagepack.md
Last active July 10, 2021 09:01
Benchmark of JSON vs MessagePack (de)serializazion with ArduinoJson on MCUs
@bblanchon
bblanchon / payhip-success.json
Created December 4, 2018 08:14
PayHip: object passed to the success callback
{
"transactionKey": "43ffa7e64bdd0c1ffa3bfcbc551e466aa5346293",
"buyer": "buyer@example.com",
"total": "12.34",
"currency": "USD",
"user_id_hash": "O1wW94N4KT",
"items": [
{
"productName": "My Awesome Product",
"productLink": "oU5g",
@paivaric
paivaric / 1.google-analytics-proxy-nginx.conf
Last active January 30, 2024 17:21
Google Analytics Proxy using Nginx to bypass Adblock and other blockers
server {
listen 80;
server_name your.domain.com;
location = /analytics.js {
# you have to compile nginx with http://nginx.org/en/docs/http/ngx_http_sub_module.html (this is not default)
# and http://nginx.org/en/docs/http/ngx_http_proxy_module.html (it's a default module)
proxy_set_header Accept-Encoding "";
@hagemann
hagemann / slugify.js
Last active October 30, 2023 09:10
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@iissnan
iissnan / tail.ps1
Last active December 13, 2020 11:39
Unix tail equivalent command in Windows Powershell
Get-Content ./log.log -Wait -Tail 10

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@vitorfs
vitorfs / example.html
Last active August 23, 2023 05:44
Startswith Template Filter
{% load startswith %}
<li{% if request.path|startswith:'/settings/' %} class="active"{% endif %}>
@parshap
parshap / mdn-search.md
Last active January 24, 2024 17:56
Chrome shortcut to search MDN

mdn Chrome Search Shortcut

Shortcut to perform a Google I'm Feeling Lucky search on https://developer.mozilla.org.

MDN search animation

1. Settings: Manage search engines...

Google Chrome Settings Page