Skip to content

Instantly share code, notes, and snippets.

@elycruz
elycruz / modal-dialog-custom-backdrop.js
Last active February 18, 2024 01:58
Modal dialog '::backdrop' replacement.
/**
* Custom modal "backdrop" animation replacement, until `::backdrop` animations are supported.
*/
document.body.innerHTML = `
<style>
body {
display: grid;
place-content: center;
}
/* Demo: https://js-toggle-custom-element.stackblitz.io/ */
[is='toggle-container'] > *:not([is='toggle-button']) {
display: none;
}
[is='toggle-container'][open] > *:not([is='toggle-button']) {
display: block;
}
@JoeyBurzynski
JoeyBurzynski / how-to-deal-with-unhandled-exceptions-and-unhandled-promise-rejections-in-javascript.md
Last active October 7, 2022 07:54
JavaScript: How to Deal with Unhandled Exceptions & Unhandled Promise Rejections in JavaScript
@EllyLoel
EllyLoel / reset.css
Last active June 28, 2024 04:00
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@joshnuss
joshnuss / .bash_aliases
Created January 31, 2022 15:31
bash alias for creating svelte-kit projects
sk() {
pnpm init svelte@next $1 \
&& cd $1 \
&& pnpm install \
&& git init \
&& git add . \
&& git commit -m 'Initial commit'
}
@pbrocks
pbrocks / install-phpcs-with-homebrew.md
Last active June 3, 2024 14:27
Install phpcs with Homebrew

Install phpcs with Homebrew

To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:

In a terminal window on your Mac, start by updating your Homebrew.

brew doctor

Then install the Code Sniffer:

@Graf-Zahl
Graf-Zahl / .env
Created April 3, 2020 07:57
jitsi meet for nginx-proxy and letsencrypt-proxy
# Directory where all configuration will be stored.
CONFIG=./jitsi-meet-cfg
# System time zone.
TZ=Europe/Amsterdam
# Public URL for the web service.
PUBLIC_URL=https://mydomain.org
# Virtual host for nginx proxy
<?php
/**
* ✔ pos. tested with Parsedown 1.7.4
*
* This allows usage of image dimensions this way:
* ![odyssee2001](http://example.com/Odyssey2001.png =100x100)
* ![odyssee2001](http://example.com/Odyssey2001.png =100x100 "Even with Title")
*
* @related
@james2doyle
james2doyle / sqlite-api.php
Created May 12, 2019 21:27
Turn Sqlite into a public, read-only, JSON API
<?php
function json_response(int $code = 200, array $data = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header('Cache-Control: public, max-age=300');
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 29, 2024 14:14
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}