Skip to content

Instantly share code, notes, and snippets.

@lindesvard
lindesvard / bash
Created June 9, 2024 10:13
Secure VPS
chmod +x setup.sh
sudo ./setup.sh
@chrismccord
chrismccord / dev.exs
Created May 8, 2024 20:06
Live Reload LiveView notify
config :wps, WPSWeb.Endpoint,
live_reload: [
notify: [
live_view: [
~r"lib/wps_web/core_components.ex$",
~r"lib/wps_web/(live|components)/.*(ex|heex)$"
]
],
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
@dmmulroy
dmmulroy / gleam_ts_gen.d.ts
Created March 14, 2024 01:05
Generating TypeScript declaration files with Gleam
import type * as $io from "../gleam_stdlib/gleam/io.d.mts";
import type * as _ from "./gleam.d.mts";
export class User extends _.CustomType {
constructor(id: string, username: string, role: Role$);
id: string;
username: string;
role: Role$;
}

Trying Ezno checking today

This a short overview of some of the things you can do with Ezno today. If you find any problems, file an issue.

The following examples show some errors that have been caught using type checking, partial/const evaluation and effects.

To get started we will install oxidation-compiler which has bindings for Ezno's checker. (you can also get the binary from the releases page).

npm install -g oxidation-compiler@latest
@kcristiano
kcristiano / civiup.sh
Last active June 15, 2024 14:49
Civi Update
#!/bin/bash
# The script was built for debian - paths may vary
PHPCLI="/usr/local/bin/php"
WPCLI="/usr/local/bin/wp-cli.phar"
WP="/usr/local/bin/wp"
CV="/usr/local/bin/cv"
DATE=$(date +%Y%m%d-%I%M%S)
echo "Hello, "$USER". This script will update CiviCRM."
echo "This script requires minimum version of WordPress 5.4. CiviCRM 5.35 amd PHP 7.3."
read -p "Press [Enter] key to start the backups and updates."
@alekseykulikov
alekseykulikov / ct-bookmark.js
Created September 30, 2022 09:54
Bookmark version of [CT](https://github.com/csswizardry/ct) with some improvements
/**
* Credit: https://github.com/csswizardry/ct
*
* Main changes:
* - use as a bookmark (toggle on/off)
* - work with any CSP (no extrnal scripts/styles)
* - fix an issue with async scripts added using inline JS (impossible to detect with css)
* - improved styles detection with [rel='stylesheet'][href]
*
* Add JS bookmark -> javascript:(<code below>)
@EllyLoel
EllyLoel / reset.css
Last active September 30, 2025 18:40
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/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@RemcoWessels
RemcoWessels / wordpress-auto-add-alttext-on-upload.php
Last active January 21, 2022 16:41
WordPress function; As it is important for a11y (accessibility) that images got an ALT text this function adds, on upload, the IPTC description from the image to the "Alternative Text" field within WordPress.
/* Automatically set an image Alt-Text on upload */
add_action( 'add_attachment', 'kreks__add_alt_text_from_image_IPTC_on_upload' );
function kreks__add_alt_text_from_image_IPTC_on_upload( $post_ID ) {
// Check if uploaded file is an image, else do nothing
if ( wp_attachment_is_image( $post_ID ) ) {
$postMeta = get_post_meta($post_ID);
$uploads = wp_get_upload_dir();
$imgURL = $uploads['basedir'] . "/" . $postMeta['_wp_attached_file']['0'];
@daviddarnes
daviddarnes / .eleventy.js
Last active February 14, 2022 02:10
Compile JavaScript and Sass in Eleventy using UglifyJS and Sass lib
const terser = require("terser");
const sass = require("sass");
module.exports = (eleventyConfig) => {
// Compile Sass
eleventyConfig.addTemplateFormats("scss");
eleventyConfig.addExtension("scss", {
outputFileExtension: "css",
compile: function (contents, inputPath) {
@Andy-set-studio
Andy-set-studio / _vertically-align-label.scss
Last active May 15, 2025 09:24
Adds a pseudo-element to help vertically align text labels in buttons/block-like links without using magic numbers https://ishadeed.com/article/button-label-alignment/
/// VERTICALLY ALIGN LABEL
/// Adds a pseudo-element to help vertically align
/// text labels in buttons/block-like links without
/// using magic numbers
/// More: https://ishadeed.com/article/button-label-alignment/
@mixin vertically-align-label() {
&::before {
content: '';
display: inline-block;
vertical-align: middle;