Skip to content

Instantly share code, notes, and snippets.

View techb's full-sized avatar

K.B. Carte techb

View GitHub Profile
<?php
/*
Template Name: AR Example
Don't use get_header() or get_footer()
this page needs to be 'blank' so the cam/ar view takes the whole
screen/canvas and no styles are applied except the ones we define here.
Some info and docs:
General
states = [
'Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'District of Columbia',
// When the user scrolls the page, execute myFunction
window.onscroll = function() {myFunction()};
// Get the header
var header = document.getElementById("myHeader");
// Get the offset position of the navbar
var sticky = header.offsetTop;
var stickyBottom = header.offsetBottom;
:: https://stackoverflow.com/questions/15885132/file-folder-chooser-dialog-from-a-windows-batch-script
@echo off
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
set dialog=%dialog%close();resizeTo(0,0);</script>"
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "file=%%p"
echo selected file is : "%file%"
@techb
techb / jess.py
Last active September 25, 2020 12:32
def decimal2binary(n):
# check if larger than 255 as per requirements
if n > 255:
return "Int too large"
# this is the string we're returning
binStr = ""
# this will loop forever if n never gets to or below 0
while n > 0:
@techb
techb / TestEmailSend.cls
Created June 17, 2020 13:38
Unit test for sending emails in Apex
@isTest
public class TestEmailSend {
@isTest
static void testTheEmail(){
Test.startTest();
// the method we're testing
// https://gist.github.com/techb/7519e95bac3caa2b8adb3f65d2dc2dc8
EmailSend.sendEmail('[email protected]');
// we assert buy what govener limits say
@techb
techb / EmailSend.cls
Created June 17, 2020 13:37
Utility for sending single emails in Apex with an org-wide email address
public class EmailSend {
public static void sendEmail(String candidate){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[]{candidate});
mail.setReplyTo('hr_address@my_company.com');
mail.setSubject('Thank You');
// https://help.salesforce.com/articleView?id=000340122&type=1&mode=1
// org-wide email address needs to be set
@techb
techb / oktana_training_sofar.md
Last active March 20, 2020 16:47
Consolidated list of training material.
@techb
techb / email_perm_set.cls
Created March 16, 2020 19:44
Email Addresses by Permission Set
// Get list of email addresses by Permission Set
public static List<String> getEmailByPermSet(String permsetname){
List<Id> just_ids = new List<Id>();
List<PermissionSetAssignment> users = [
SELECT AssigneeId
FROM PermissionSetAssignment
WHERE PermissionSet.Name = :permsetname
];
for(PermissionSetAssignment uid: users){
just_ids.add(uid.AssigneeId);