Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@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
@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');