Skip to content

Instantly share code, notes, and snippets.

View tlenclos's full-sized avatar

Thibault Lenclos tlenclos

View GitHub Profile
@tlenclos
tlenclos / character-counter.ts
Last active November 17, 2022 14:37
Character counter with emoji support
// Since maxLength attribute doesn't work properly with emojis, we need to manually implement it's behavior
input.addEventListener('input', () => {
const valueArray = [...Array.from(input.value)].splice(0, maxLength);
input.value = valueArray.join('');
counterDisplayTarget.textContent = `${maxLength - valueArray.length}`;
});
@tlenclos
tlenclos / mediapart.lighthouse.report.json
Last active January 18, 2018 15:35
Mediapart panoramique audit
This file has been truncated, but you can view the full file.
{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36","lighthouseVersion":"2.5.1","generatedTime":"2018-01-18T15:26:05.503Z","initialUrl":"https://www.mediapart.fr/studio/panoramique","url":"https://www.mediapart.fr/studio/panoramique","audits":{"is-on-https":{"score":true,"displayValue":"","rawValue":true,"extendedInfo":{"value":[]},"scoringMode":"binary","name":"is-on-https","category":"Security","description":"Uses HTTPS","helpText":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https).","details":{"type":"list","header":{"type":"text","text":"Insecure URLs:"},"items":[]}},"redirects-http":{"score":true,"displayValue":"","rawVal

Keybase proof

I hereby claim:

  • I am tlenclos on github.
  • I am thibz (https://keybase.io/thibz) on keybase.
  • I have a public key whose fingerprint is B69A BC85 B63D E21F E86D 9FC1 524A 4407 5362 AF09

To claim this, I am signing this object:

class Element {
constructor(cargo, next) {
this.cargo = cargo;
this.next = next;
}
}
// FIFO
class Queue {
constructor(cargo, next) {
@tlenclos
tlenclos / 0_reuse_code.js
Created March 20, 2014 09:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tlenclos
tlenclos / If test
Created August 20, 2013 09:46
If test
if (attributions > 0) {
$.attributionsPicker.add(attributions);
}
// OR
attributions > 0 && $.attributionsPicker.add(attributions);
exports.extendCollection = {
deleteAll : function() {
var collection = this;
db = Ti.Database.open(collection.config.adapter.db_name);
db.execute(squel.delete().from(collection.config.adapter.collection_name));
db.close();
collection.trigger('sync');
},
@tlenclos
tlenclos / Laravel\Database\Connectors
Created May 11, 2012 13:52
Laravel\Database\Connectors::options(), cannot override the default connection options
<?php namespace Laravel\Database\Connectors; use PDO;
abstract class Connector {
/**
* The PDO connection options.
*
* @var array
*/
protected $options = array(