Skip to content

Instantly share code, notes, and snippets.

Working from … anywhere

Karl Dubost karlcow

Working from … anywhere
Block or report user

Report or block karlcow

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
@karlcow
karlcow / test_image.md
Last active Nov 21, 2019
Testing GitHub for images
View test_image.md

The goal is to test what GitHub is really doing with the images.

first experiment.

Link an image

![amanite one](http://la-grange.net/tmp/amanite01.webp)

And check the markup and the server logs

@karlcow
karlcow / doctest_tdd.py
Created Oct 31, 2019
Trying to create an example of doctests for testing a function. Developed in the spirit of TDD.
View doctest_tdd.py
import doctest
import datetime
def post_date(content):
"""
Extract the date from the content
>>> post_date('Date: 2019-10-31')
'2019-10-31'
>>> post_date('Date: foobar')
@karlcow
karlcow / list.sh
Last active Oct 18, 2019
listing files with date, size and path
View list.sh
# find .: search here
# -type f: file only
# -print: output format
# '%TY-%Tm-%Td: date iso
# %s : file size
# %p\n' : path and return
# |: pipe to another command
# column -t: the results are aligned
find . -type f -printf '%TY-%Tm-%Td %s %p\n' | column -t
@karlcow
karlcow / larger_than.js
Created Sep 2, 2019
Iterate through the DOM to search element wider than a certain width.
View larger_than.js
// Iterate through the DOM to search element wider than a certain width.
// Practical for issues with invisible blocks creating layout issues
// on mobile.
// set here the maxwidth of your choice.
var maxwidth = 414;
var startElem = document.getElementsByTagName('body')[0];
var items = startElem.getElementsByTagName("*");
for (var i = items.length; i--;) {
if (items[i].getBoundingClientRect()['width'] > maxwidth) {
console.log(items[i], items[i].getBoundingClientRect()['width'])
View sitewait-open-2019-08-27.txt
329 severity-critical 2019-07-16T17:55:32Z
803 severity-important 2019-06-20T14:25:42Z
861 null 2019-08-22T12:52:53Z
1061 severity-important 2019-08-22T14:16:19Z
1551 severity-critical 2019-08-23T11:50:25Z
1804 severity-important 2019-08-22T11:43:37Z
2005 severity-critical 2019-08-23T12:22:30Z
2009 severity-important 2019-08-22T13:56:12Z
2070 severity-critical 2019-08-22T13:05:51Z
2498 severity-important 2019-08-24T23:25:50Z
View testcase-reducer.css
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
overflow: hidden;
width: 100%;
}
@karlcow
karlcow / fastclick.md
Last active May 20, 2019
Documenting fastclick finding on webcompat.com
View fastclick.md
View selector-mad.css
.Intro-content .sqs-col-12>.sqs-block:not(.float):not(.sqs-float-left):not(.sqs-float-right):not(.sqs-block-gallery):not(.sqs-block-image):not(.sqs-block-video):not(.sqs-block-map):not(.sqs-block-calendar):not(.sqs-block-menu):not(.sqs-block-tourdates):not(.sqs-block-summary-v2):not(.sqs-block-archive):not(.sqs-block-instagram),
.Main:not(.Main--events-list):not(.Main--events-item):not(.Main--blog-list) .Main-content .sqs-layout .sqs-col-12>.sqs-block:not(.float):not(.sqs-float-left):not(.sqs-float-right):not(.sqs-block-gallery):not(.sqs-block-image):not(.sqs-block-video):not(.sqs-block-map):not(.sqs-block-calendar):not(.sqs-block-menu):not(.sqs-block-tourdates):not(.sqs-block-summary-v2):not(.sqs-block-archive):not(.sqs-block-instagram),
.tweak-blog-list-style-stacked .BlogList--posts-full .sqs-layout .sqs-col-12>.sqs-block:not(.float):not(.sqs-float-left):not(.sqs-float-right):not(.sqs-block-gallery):not(.sqs-block-image):not(.sqs-block-video):not(.sqs-block-map):not(.sqs-block-calendar):not(.sqs-block-menu
View gif.worker.js
(function(b) {
function a(b, d) {
if ({}.hasOwnProperty.call(a.cache, b)) return a.cache[b];
var e = a.resolve(b);
if (!e) throw new Error('Failed to resolve module ' + b);
var c = {
id: b,
require: a,
filename: b,
exports: {},
View resize-filter.py
from PIL import Image
import time
FILTER_LIST = [('nearest', Image.NEAREST),
('bilinear', Image.BILINEAR),
('bicubic', Image.BICUBIC),
('lanczos', Image.LANCZOS),
('antialias', Image.ANTIALIAS)]
FILE = '/Users/karl/Documents/2016/10/12/thumbnail-test/original.png'
SIZE = (500, 500)
You can’t perform that action at this time.