Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env php
<?php
require_once __DIR__ . '/lib/Less/Autoloader.php';
Less_Autoloader::register();
$opt = [
'cache_dir' => '/tmp/lessphp-example'
];
$input = __DIR__ . '/test/Fixtures/bootstrap-3.2/less/bootstrap.less';
@Krinkle
Krinkle / History-to-blog.js
Created January 16, 2025 20:54
Convert a markdown changelog to blog posts, compatible with Jekyll and Eleventy. Used by https://qunitjs.com/
/* eslint-env node */
'use strict';
import cp from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
const CHANGELOG_FILE = './History.md';
const MAILMAP_FILE = '.mailmap';
const FIRST_TODO = '2.23.1 / ';
@Krinkle
Krinkle / make-package-contents.php
Created August 5, 2024 17:16 — forked from tstarling/make-package-contents.php
PECL package <contents> tag generator
<?php
define( 'INDENT', ' ' );
$files = shell_exec(
'git -C ' . escapeshellarg( __DIR__ ) .
' ls-tree --name-only -r HEAD'
);
if ( !$files ) {
@Krinkle
Krinkle / Fresh macOS Setup.md
Created July 20, 2024 17:09 — forked from ashfurrow/Fresh macOS Setup.md
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
@Krinkle
Krinkle / rl-startup-diff.php
Created April 4, 2024 00:50
MediaWiki ResourceLoader startup diff
<?php
$startupUrls = [
'enwiki-canonical' => 'https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector',
'enwiki-mobile' => 'https://en.m.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=minerva&target=mobile',
];
define( 'STARTUPREG_JSON_START', 'mw.loader.register([' );
define( 'STARTUPREG_JSON_START_OFFSET', 'mw.loader.register(' );
define( 'STARTUPREG_JSON_END', ']);' );
@Krinkle
Krinkle / CSVtoJSon.js
Last active February 29, 2024 06:45 — forked from codepo8/CSVtoJSon.js
OK, here is my function to turn CSV into JSON - what's yours?
const csvToJSON = (csv) => {
const getcsvdata = (csv) => {
const csvRegex = /,(?=(?:(?:[^"]*"){2})*[^"]*$)/;
const trimQuotes = /^"|"$/g;
csv = csv.split(csvRegex).map(
h => h.trim().replace(trimQuotes, '')
);
return csv;
}
let lines = csv.split('\n');
@Krinkle
Krinkle / Split Tabs to New Window.scpt
Created December 8, 2023 07:02 — forked from gruber/Split Tabs to New Window.scpt
An AppleScript for Safari to move all tabs in the frontmost window, from the current tab to the rightmost (last) tab, to a new window.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- Original script: John Gruber (https://daringfireball.net/linked/2023/12/05/an-applescript-for-safari-split-tabs-to-new-window)
-- Much more elegant version: Leon Cowle (https://github.com/leoncowle)
tell application "Safari"
(*
`tab` properties:
index
#!/usr/bin/python3
#
# Convert an Apple iTunes Music Library.xml file into a set of .m3u playlists.
#
# Copyright 2023 Timo Tijhof <https://timotijhof.net>
# Copyright 2006 Mark Huang <[email protected]>
#
# SPDX-License-Identifier:: GPL-2.0 <https://opensource.org/licenses/GPL-2.0>
#
# Changelog:
/**
* Unique sets in JavaScript
*
* Inspired by https://fosstodon.org/@[email protected]/109354031141521705
*
* Author: Timo Tijhof (2022).
* License: Public domain.
*/
const NAMES = [
@Krinkle
Krinkle / crypto-aes-gcm.js
Last active March 3, 2023 04:14 — forked from chrisveness/crypto-aes-gcm.js
AES-GCM text encryption using Web APIs
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');