Skip to content

Instantly share code, notes, and snippets.

@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
*/
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var q1 = sforce.connection.query("SELECT Id, Name, PBSI__Item__r.Id, PBSI__Total_Quantity__c FROM PBSI__Lot__c where PBSI__Item__r.Name ='" + item + "' AND PBSI__Total_Quantity__c > 0.1");
var lots = q1.getArray("records");
var inserts = []
for (var i=0; i<lots.length; i++) {
var newLine = new sforce.SObject("PBSI__Count_Line__c");
newLine.PBSI__Count_Journal__c = '{!PBSI__Count_Journal__c.Id}';
newLine.PBSI__Item__c = lots[i].PBSI__Item__r.Id;
/* SOQL #1 */
SELECT CreatedById, MAX(Final_Order_Total__c)'amount' FROM PBSI__PBSI__Sales_Order__c WHERE CreatedDate = YESTERDAY;
/* SOQL #2 */
/* A query can require data from a previous query */
SELECT FullName FROM User WHERE Id = {{query1.[0].CreatedById}}