Skip to content

Instantly share code, notes, and snippets.

View Boldewyn's full-sized avatar

Manuel Strehl Boldewyn

View GitHub Profile
@deebloo
deebloo / shadow-element.ts
Last active January 25, 2023 22:04
Small utility for apply html template and construct-able stylesheets to custom elements.
View shadow-element.ts
import { shadow, ShadowTemplate, html, css } from './shadow.js';
const template: ShadowTemplate = {
css: css`
:host {
display: contents;
}
`.
html: html`
<slot></slot>
@sindresorhus
sindresorhus / esm-package.md
Last active March 4, 2024 15:34
Pure ESM package
View esm-package.md

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@boina-n
boina-n / bash-smtp.sh
Created June 1, 2020 17:58
Send email with bash in in TLS, SSL or in plain text
View bash-smtp.sh
#!/bin/bash
subject="Subject of my email"
txtmessage="This is the message I want to send"
username='mail@exemple.com'
password='************'
From="mail01@exemple.com"
rcpt='testemail5739230@yopmail.com'
from_name='N BOINA'
rcpt_name='Nicolas Hulot'
@barryosull
barryosull / index.php
Created February 28, 2020 10:32
PHPUnit Code Coverage Report of Web App
View index.php
<?php
/**
How to run a code coverage report on a web page:
Simply put this code after the vendor require and before the rest of the calling logic.
(Assumes you have PHPUnit installed)
**/
require_once __DIR__ . "/../vendor/autoload.php";
View inputmode-detect-and-track.js
(function () {
var previousInputMode = false;
var inputMode = (function() {
try {
var inputMode = window.sessionStorage.getItem('inputMode');
if (!inputMode) {
return undefined;
}
if (window.ga) {
window.ga('set', 'dimension1', inputMode);
@veltman
veltman / README.md
Last active December 18, 2020 08:51
Centerline label placement
View README.md

Implementing a variation of Joachim Ungar's curved label placement method described here. The basic process is:

  1. Turn the shape into a polygon of evenly-spaced points.
  2. Generate a Voronoi diagram of those points.
  3. Clip the edges.
  4. Turn the edges into a graph.
  5. Find the "longest shortest path" between any pair of perimeter nodes.
  6. Smooth/simplify that path a bit.
  7. Place text along the smoothed centerline with a <textPath>.
@sloanlance
sloanlance / jq_jsonl_conversion.md
Last active February 12, 2024 10:36
jq: JSONL ↔︎ JSON conversion
View jq_jsonl_conversion.md

jq: JSONL ↔︎ JSON conversion

  1. JSONL → JSON

    jq -s '.' input.jsonl > output.json
  2. JSON → JSONL

jq -c '.[]' input.json > output.jsonl

@claytonrcarter
claytonrcarter / README.md
Last active December 18, 2023 15:31
Bash script to check GitLab pipeline status
View README.md

A super simple bash script to check the status of a GitLab CI pipeline.

$ git push
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"pending"
...
$ git pipeline-status
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 4, 2024 19:47 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
View AuthyToOtherAuthenticator.md