Skip to content

Instantly share code, notes, and snippets.

💭
(╯°□°)╯︵ ┻━┻

David Larlet davidbgk

💭
(╯°□°)╯︵ ┻━┻
Block or report user

Report or block davidbgk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidbgk
davidbgk / index.html
Last active Dec 30, 2019
Upload images form with drag & drop and previews and progress upload
View index.html
<!doctype html><!-- This is a valid HTML5 document. -->
<!-- Screen readers, SEO, extensions and so on. -->
<html lang=fr>
<!-- Has to be within the first 1024 bytes, hence before the <title>
See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
<meta charset=utf-8>
<!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
<!-- The viewport meta is quite crowded and we are responsible for that.
See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
<meta name=viewport content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no">
@davidbgk
davidbgk / setup.cfg
Created Dec 17, 2019 — forked from althonos/setup.cfg
A `setup.cfg` template for my Python projects
View setup.cfg
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = {version}
author = Martin Larralde
author-email = martin.larralde@ens-paris-saclay.fr
home-page = https://github.com/althonos/{name}
description = {description}
long-description = file: README.rst, CHANGELOG.rst
@davidbgk
davidbgk / http_streaming.md
Created Nov 8, 2018 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@davidbgk
davidbgk / nginx.conf
Created May 3, 2018
nginx conf to proxy carto tiles
View nginx.conf
proxy_cache_path /srv/user/cache levels=1:2 keys_zone=tiles-cache:8m max_size=500000m inactive=1000d;
proxy_temp_path /srv/user/cache/tmp;
upstream openaip_backend {
server 1.tile.maps.openaip.net;
server 2.tile.maps.openaip.net;
server 3.tile.maps.openaip.net;
}
upstream cartodb_backend {
@davidbgk
davidbgk / stimulus.html
Last active Mar 27, 2018
Playing with Stimulus tutorial
View stimulus.html
<!doctype html>
<meta charset=utf-8>
<title>Hello Stimulus</title>
<script src="https://unpkg.com/stimulus/dist/stimulus.umd.js"></script>
<script>
window.addEventListener('DOMContentLoaded', _ => {
const application = Stimulus.Application.start()
application.register('hello', class extends Stimulus.Controller {
static get targets () {
View beautiful-html5-dialog.css
dialog {
position: fixed;
top: 50%;
left: 50%;
right: auto;
padding: 30px;
transform: perspective(500px) translate(-50%, -50%);
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF;
border: none;
border-radius: 3px;
@davidbgk
davidbgk / stats.md
Created Jun 22, 2017
Statistiques autour des données datagouv compilées pendant la Workweek
View stats.md

Stats Datagouv

Au 2017-06-20, il y a 65535 resources et 24699 datasets.

Il y a 52618 ressources de type file, 17642 de type remote et 409 de type api.

Il y a 37847 ressources inspire + geo-ide récupérées via la passerelle Inspire sur les 65535 resources disponibles (soit 58%) qui sont indiquées comme étant de type file alors qu’elles sont remote.

Il y a donc 14771 ressources locales de type file auxquelles il faut enlever les anciennes ressources (v1 de datagouv) qui dupliquaient les données distantes ainsi que les données publiées via l’API sans préciser le type (file est le type attribué par défaut (?)).

@davidbgk
davidbgk / index.html
Last active Sep 26, 2017
Dealing with (non)critical CSS, the progressive enhancement way
View index.html
<!doctype html><!-- This is a valid HTML5 document. -->
<meta charset=utf-8><!-- Better(?) to include encoding before the <title>. -->
<title>Test template</title><!-- Required to make a valid HTML5 document. -->
<link rel=icon href="data:;base64,iVBORw0KGgo="><!-- Blank gif, avoids an extra query. -->
<style>
/* Critical CSS only: above the fold, positionning and so on. */
p { background-color: red; }
</style>
<!-- Preload the not critical CSS for future usage. -->
<link rel=preload href=not-critical.css as=style onload="this.rel='stylesheet'">
@davidbgk
davidbgk / index.html
Last active May 8, 2017
Test with SkateJS and Firefox 53
View index.html
<!doctype html>
<meta charset=utf-8>
<title>Test skatejs</title>
<link rel=icon href="data:;base64,iVBORw0KGgo=">
<script src=https://unpkg.com/skatejs-web-components@0.0.1/dist/index.min.js></script>
<script src=https://unpkg.com/skatejs@4.6.7/dist/index-with-deps.min.js></script>
<script>
const { skate } = window
class Hello extends skate.Component {
static get is () {
@davidbgk
davidbgk / server.py
Created Apr 11, 2017
An attempt to create the simplest HTTP Hello world in Python3
View server.py
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')
You can’t perform that action at this time.