Skip to content

Instantly share code, notes, and snippets.

/**
* Weather Alerts Script for Google Sheets
*
* This script automatically fetches and updates weather alerts from the National Weather Service
* for a list of ZIP codes in a Google Sheet.
*
* Sheet Layout:
* - Column F: ZIP codes (starting from row 3)
* - Column G: Weather alerts (starting from row 3)
* - Cell G2: Last update timestamp
1x UDM, v1.8.3.2949, minRSSI set, Band Steering: Prefer 5G
1x US-8-60W, v5.43.18.12487
2x BeaconHD, v4.3.21.11325. minRSSI set, Band Steering: Prefer 5G
1x Flex-Mini, v1.8.3.671
1x Unifi Smart Plug, v1.2.1.361
1x nanoHD (currently not in use), v4.3.21.11325
Wifi Networks
Home: 2.4 & 5Ghz, Fast Roaming ON, UAPSD ON, BSS Transition ON, Proxy ARP ON. 2G and 5G minimum data rate control ON
Home-IoT_2G: 2.4Ghz only, UAPSD ON, BSS Transition ON, Proxy ARP ON. 2G minimum data rate control ON
@samteezy
samteezy / referer.cls
Last active December 10, 2018 21:27
Passing parameters from referer/parent VF page to iframe/child VF page
public class Object_ext{
public final Object__c ob;
public String objId {get;set;}
public String referer {get;set;}
public Project_ext(ApexPages.StandardController stdController) {
referer = ApexPages.currentPage().getHeaders().get('Referer');
System.debug(referer); //Just to check!
@samteezy
samteezy / clonedataextension.html
Last active February 17, 2022 15:43
Marketing Cloud: Clone Data Extension into Different Folder
<script runat="server">
Platform.Load("Core", "1");
try {
var prox = new Script.Util.WSProxy();
var guid = Platform.Function.GUID();
//Set oldname to CustomerKey of data extension you want to clone.
var oldname = "Sample_Name";
//Set categoryid to determine the target folder. This can be found by hovering over the folder in the browser window and pulling the number at the end of the status bar.
var categoryid = 12345;
@samteezy
samteezy / SurveyListsandDEs.html
Last active August 7, 2018 15:05
Marketing Cloud: Survey All Lists and DEs
<script runat="server">
Platform.Load("Core","1");
try {
var prox = new Script.Util.WSProxy();
var queryAllAccounts = true;
/* Retrieve All List Info */
var objectType = "List";
@samteezy
samteezy / copyDE.txt
Created July 10, 2018 14:46
SSJS to copy DEs (especially synchronized DEs)
%%[
VAR @Result
]%%
<script runat="server">
Platform.Load("Core", "1.1.1");
try {
var DEtoCopy = DataExtension.Init("Contact_Salesforce");
var jsonArray = DEtoCopy.Fields.Retrieve();
for(var i = 0; i < jsonArray.length; i++) {
@samteezy
samteezy / gist:b1729238ce9a4dfa9153777a46a21dfa
Created April 19, 2018 19:57
Formula field to format currency values properly in a text field
IF(
CurrencyField__c>= 1000000,
TEXT(FLOOR(CurrencyField__c / 1000000)) & ",",
"") &
IF(
CurrencyField__c >= 1000,
RIGHT(TEXT(FLOOR(CurrencyField__c / 1000)), 3) & ",",
"") &
RIGHT(TEXT(FLOOR(CurrencyField__c)), 3) & "." &
IF(
@samteezy
samteezy / gist:399832153c88537a26a31b92bbfbd564
Last active April 2, 2018 20:13
Create a task via a flow where Community license users are not allowed to create tasks.
public class createTaskFlow{
@InvocableMethod(label='Create task' description='create tasks')
public static void insertTasks(List<Task> tasks) {
// system.debug('tasks ' + tasks);
// Note this is built for inserting just one task and is not bulkified.
for (task t:tasks){
task newTask = new task();
newTask.priority = string.valueof(t.priority);
newTask.status = string.valueof(t.status);
newTask.ownerId = t.ownerId;