This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from 'stimulus'; | |
/** | |
* Help manage disabling of buttons through the `aria-disabled` | |
* attribute, rather than the harsher `disabled` attribute. | |
* Set on the `<html>` or `<body>` element, and get: | |
* - automatic cancellation of `click` events from targets | |
* with or within an`aria-disabled` element | |
* - two actions (`cancelIfDisabled`, `cancelUnlessDisabled`) | |
* to prevent events and stop their propagation if or unless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper functions for managing button disabling through `aria-disabled` | |
* rather than the `disabled` attribute, which is less accessible. | |
* Includes functions for setting the disabled state, | |
* testing whether an element is disabled and a listener for preventing events | |
* @module aria_disabled | |
*/ | |
/** | |
* @param {HTMLElement} element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import puppeteer from "puppeteer"; | |
const app = express(); | |
const port = process.env.PORT || 8080; | |
async function makePDF(url) { | |
console.log('Creating PDF', url); | |
const browser = await puppeteer.launch({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Resets the value of a given form `element` to that originally set in the HTML. | |
* Allows for more targetted reset that a `form.reset()` as neither HTMLFieldsetElement | |
* nor the specific form controls API have a `reset()` method. | |
* | |
* Form elements can be accessed through: | |
* - `fieldset.elements` if your elements are wrapped within a fieldset | |
* - `ancestorElement.querySelectorAll('input,textarea,select')` | |
* - `form.elements` if you need specific filtering over the form fields | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates an event handler for keyboard events | |
* that looks up the actual method to execute | |
* in a hash of methods using the event's `code`: | |
* | |
* ```js | |
* element.addEventListener(keydown, keyboardEventHandler({ | |
* onArrowUp(event) {}, | |
* onArrowDown(event) {}, | |
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.parent { | |
color: red; | |
} | |
.child { | |
@extend .parent; | |
} | |
.container { | |
.parent { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ideally read those 4 settings from environment variables | |
// with `getenv` to make the script more portable. Only one | |
// of the `$error_...` needs to have a value. | |
// The base_url to which the path will be appended | |
// when checking for a fallback. No trailing slash. | |
$base_url = "https://example.com"; | |
// A URL to redirect to if the fallback didn't serve the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function send( | |
url, | |
{ method = 'GET', data, headers = {}, user, password, ...opts } = {} | |
) { | |
const xhr = new XMLHttpRequest(); | |
const promise = new Promise((resolve, reject) => { | |
xhr.open(method, url, true, user, password); | |
xhr.addEventListener('load', resolve); | |
xhr.addEventListener('error', reject); | |
xhr.addEventListener('abort', reject); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin scrollable-overlay { | |
overflow: auto; | |
// iOS Specific tweaks | |
// See for hack explanation: http://browserbu.gs/css-hacks/webkit-full-page-media/ | |
_::-webkit-full-page-media, & { | |
overflow-y: scroll; | |
-webkit-overflow-scrolling: touch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
cd "$(dirname "${BASH_SOURCE[0]}")" | |
./ovh-download-logs.sh `date --date=yesterday +"%Y-%m-%d"` | zcat | ./piwik-import.sh |
NewerOlder