Skip to content

Instantly share code, notes, and snippets.

View davidbgk's full-sized avatar
🚪
Let’s escape GAFAM+ when/while we can!

David Larlet davidbgk

🚪
Let’s escape GAFAM+ when/while we can!
View GitHub Profile
/**
* cloneNode(true), but also clones shadow roots.
* @param {Element}
* @param {ShadowRoot[]} [shadowRoots] Any closed shadow roots passed here will be included.
*/
function cloneWithShadowRoots(node, shadowRoots) {
function walk(node, clone) {
let shadow = node.shadowRoot || shadowRoots.find(r => r.host === node);
if (shadow) {
clone.attachShadow({ mode: shadow.mode }).append(...[].map.call(shadow.childNodes, c => c.cloneNode(true)));
@davidbgk
davidbgk / server.py
Created April 11, 2017 15:39
An attempt to create the simplest HTTP Hello world in Python3
import http.server
import socketserver
from http import HTTPStatus
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
self.wfile.write(b'Hello world')

Intro

Merci Agnès Crepet. Motivé pour être ici. Discussion sur mode de vie post Mix-it, 2h du mat’ en partant.

Nomadisme , connu?

{
"@context": {
"@vocab": "http://www.w3.org/ns/dcat#",
"dp": "http://dataportals.net/ns/dp#",
"schema": "http://schema.org/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"url": "@id",
"linked_portals": {
@thom4parisot
thom4parisot / Gulpfile.js
Last active September 22, 2020 11:43
gulp -> npm scripts only
'use strict';
var pkg = require('./package.json');
var gulp = require('gulp');
var utils = require('gulp-util');
var source = require('vinyl-source-stream');
var isWatching = false;
var isProduction = process.env.NODE_ENV === 'production';
@paulirish
paulirish / bling.js
Last active November 22, 2024 20:26
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@0gust1
0gust1 / gist:260638bd34a434e7f3dd
Last active September 16, 2023 16:49
Footnotes to sidenote, and maybe links to sidenotes ?
/**
* Generate sidenotes using footnotes from Multimarkdown generated content
* Idea and principle borrowed from Adrew Clark : http://acdlite.github.io/jquery.sidenotes/ and https://github.com/acdlite/jquery.sidenotes
*
* This script : - gather footnotes in the passed container selector
* - insert the sidenotes in the current text, according to screen size :
* - on big screens insert the sidenote *before* the anchor
* - on medium screens, insert the sidenote *after* the anchor
@davidbgk
davidbgk / index.html
Created December 10, 2014 20:21
Correction mise en situation du cours de HTML/CSS/JS pour l'IUT d'Arles
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Club de lecture — Lettres persanes</title>
<link rel="stylesheet" href="main.css">
</head>
<body class="cleartheme"><!-- par défaut le thème est clair -->
<div class="main"><!-- pour centrer le site -->
<article>
@karlcow
karlcow / parisweb-2015.md
Last active August 29, 2015 14:07
ParisWeb 2015 - Talk ideas

ParisWeb 2015 - Talk ideas

What are the things that could be addressed at Paris Web 2015? 10th anniversary. I will add little by little what comes to my mind.

How To Contact Web sites?

Sometimes sites are broken. There is WebCompat.com for helping to record, but what are the techniques for finding the right contacts? Learn how to find contacts on Web site. What is working, not working, maximize the chances to get the issue fixed. It's not 100% bullets proof, but it helps a lot to be more effective.

HTTP2

@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active December 9, 2024 14:15
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s