Skip to content

Instantly share code, notes, and snippets.

@smcllns
smcllns / curly.js
Last active May 30, 2025 04:08
Replaces straight quotes with curly quotes (smart quotes) within text on a html page. I'm using this script to just update the html page when rendered, since Prettier doesn't support and VS Code solutions weren't great.
// Replace straight quotes with curly quotes
// Add to a html page inside a <script> tag
(() => {
const curly = (s) =>
s
.replace(/(^|[\s([{])"(?=\S)/g, "$1\u201C") // opening double
.replace(/(?<!\d)"/g, "\u201D") // closing double
.replace(/(^|[\s([{])'(?=\S)/g, "$1\u2018") // opening single
.replace(/(?<!\d)'/g, "\u2019"); // closing single
@smcllns
smcllns / curly.js
Created May 29, 2025 20:04
# Replacing straight quotes with curly quotes (smart quotes)
// Replace straight quotes with curly quotes
// Put inside a <script> tag on your html page
(() => {
const curly = (s) =>
s
.replace(/(^|[\s([{])"(?=\S)/g, "$1“") // opening double
.replace(/"/g, "”") // closing double
.replace(/(^|[\s([{])'(?=\S)/g, "$1‘") // opening single
.replace(/'/g, "’"); // closing single
@smcllns
smcllns / Insert Current Date as YYYY-MM-DD.applescript
Created April 3, 2023 00:14
Applescript to make a keyboard shortcut to insert today's timestamp
on run {input, parameters}
set {year:y, month:m, day:d} to (current date)
set mStr to (m as integer) as string
if (m as number) < 10 then set mStr to "0" & mStr
set dStr to (d as integer) as string
if (d as number) < 10 then set dStr to "0" & dStr
@smcllns
smcllns / quicknote.html
Last active February 15, 2020 19:26
A Data URI for taking quick notes and saving to a .txt file. To Demo, paste the gist into your address bar (it's a valid URL).
data: text/html,
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
aside {
display: flex;
margin-bottom: 0.5rem;
}
header {
// if ( ( timestamp - previous timestamp [in minutes] <= 1 ) AND ( category === previous category ) )
IF (
AND(
((((TO_DATE(INDEX(SPLIT("{{ClickedAt}}" ," at ", false),1,1) + INDEX(SPLIT( "{{ClickedAt}}" ," at ", false),1,2)) - TIME(8,0,0)))
- CELL("contents", indirect("A"&row()-1))
) * 24 * 60) <= 1
, CELL("contents", indirect("B"&row()-1)) = CELL("contents", indirect("B"&row())))
,"duplicate"
,"")

Keybase proof

I hereby claim:

  • I am smcllns on github.
  • I am smcllns (https://keybase.io/smcllns) on keybase.
  • I have a public key ASDSbe3PXuWyHXMwuB0oDsVllIPWPVWT-Km-acyzcEsZKwo

To claim this, I am signing this object:

@smcllns
smcllns / PIXELSRC
Last active October 26, 2016 17:13
Make a custom formula in Google Spreadsheets to generate Segment Tracking Pixels
function BASE64(payload) {
return Utilities.base64EncodeWebSafe(payload);
}
@smcllns
smcllns / GETSALESFORCEREPORT.js
Created October 2, 2015 17:14
Get Salesforce Report data into Google Spreadsheets
var setup = {
// Add your keys
consumerKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
consumerSecret: "XXXXXXXXXXXXXX"
};
function onOpen(e) {
var menu = SpreadsheetApp.getUi().createAddonMenu();
menu.addItem('Login to SF', 'menuAuth');
menu.addItem('Update all reports', 'updateTrigger');
@smcllns
smcllns / designer.html
Created December 24, 2014 15:47
designer
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">
<link rel="import" href="../topeka-elements/avatars.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
/*
Above is how you comment-out code
AND(For_Special_Order__c = TRUE, ISCHANGED(PBSI__Sales_Order_Line__c ), OR(PBSI__Sales_Order__r.Sales_Order_Status__c <> "CANCELLED"),PBSI__Sales_Order__r.Sales_Order_Status__c <> "RESERVED")
Below is how you end a comment
*/