Skip to content

Instantly share code, notes, and snippets.

View mcaskill's full-sized avatar
🥃

Chauncey McAskill mcaskill

🥃
View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 21, 2024 16:29
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@getify
getify / 1.md
Last active March 2, 2023 21:24
In defense of using blocks to create localized scope for variables... (part 1 of 2)
@MouseEatsCat
MouseEatsCat / CharcoalValetDriver.php
Last active January 8, 2024 18:25
CharcoalValetDriver
<?php
/**
* Charcoal Valet Driver
*
* Supported Valet Version: 4
*/
namespace Valet\Drivers\Custom;
@rsms
rsms / example.txt
Last active March 11, 2023 23:00
source line-length histogram script
./linelen_hist.sh src '*.c'
COLS COUNT
2 1317 ████████████████████████████████████████████████████████████▌
4 583 ██████████████████████████▏
6 500 ██████████████████████▎
8 253 ███████████▊
10 264 ████████████▊
12 448 ████████████████████▋
14 417 ███████████████████▌
16 476 █████████████████████▍
@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@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) {
@wpmark
wpmark / readme.md
Last active February 1, 2023 11:06
An example of caching data using a WordPress transient

Caching WordPress data using Transients - Example

In this simple example we create a function for obtaining data from an external source and caching it for 24 hours. You can use the function hd_get_external_data() to get the data and work with it in your site.

If you want to force a refresh of the cache, you can pass a value of true into the function.

You can place the code into your themes functions.php file or better still in a plugin. If you are placing it in a plugin, remember to use function_exists() when using this. This ensures that the code will fail correctly if the plugin is not active.

@radiantly
radiantly / noMangleGoogle.user.js
Last active December 28, 2023 04:31
Prevent Google from mangling links on the search results when clicking or copying on Firefox
// ==UserScript==
// @name Prevent link mangling on Google
// @namespace LordBusiness.LMG
// @match https://www.google.com/search
// @grant none
// @version 1.1
// @author radiantly
// @description Prevent google from mangling the link when copying or clicking the link on Firefox
// ==/UserScript==
@sindresorhus
sindresorhus / esm-package.md
Last active May 27, 2024 08:37
Pure ESM package

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.
@sibelius
sibelius / faviconGen.sh
Created June 23, 2020 11:12
Generate a favicon from an image or svg file
#!/usr/bin/env bash
magick convert $1 -resize 16x16 16.png
magick convert $1 -resize 32x32 32.png
magick convert $1 -resize 48x48 48.png
magick convert 16.png 32.png 48.png favicon.ico