Skip to content

Instantly share code, notes, and snippets.

View benedwards44's full-sized avatar

Ben Edwards benedwards44

View GitHub Profile
@benedwards44
benedwards44 / pbes.cls
Last active September 26, 2023 21:31
Price Book Entry Creation
List<String> enbabledCurrencies = new List<String>();
for (CurrencyType curr :[SELECT IsoCode FROM CurrencyType WHERE IsActive = true]) {
enbabledCurrencies.add(curr.IsoCode);
}
List<PricebookEntry> pbesToCreate = new List<PricebookEntry>();
for (Product2 prod :[SELECT Name, (SELECT CurrencyIsoCode FROM PricebookEntries) FROM Product2]) {
@benedwards44
benedwards44 / team_assignment.py
Created November 9, 2022 02:17
Random Team Assignment
import random
TEAMS = [
'Argentina',
'Australia',
'Belgium',
'Brazil',
'Cameroon',
'Canada',
'Costa Rica',
@benedwards44
benedwards44 / salesforce_oauth.py
Last active April 23, 2019 00:10
Salesforce OAuth2 Flow (Django)
import urllib
import requests
import traceback
SALESFORCE_CONSUMER_KEY = 'XXX'
SALESFORCE_CONSUMER_SECREET = 'XXX'
SALESFORCE_REDIRECT_URI = 'https://myapp.com/salesforce/callback'
from urllib.request import urlopen
from bs4 import BeautifulSoup
HN_URL = 'https://www.harveynorman.co.nz/whiteware/laundry/clothes-dryers/simpson-4kg-clothes-dryer-en.html'
PRICE_DIV_ID = 'sec_discounted_price_54311'
GOOD_PRICE = 400
def get_price():
"""
Retrieve the price for the dryer!
@RestResource (urlMapping='/xero/webhook')
global without sharing class XeroWebhook {
@HttpPost
global static void processIntentToReceive () {
// Retrieve the Xero signature from the headers
String xeroSignature = RestContext.request.headers.get('x-xero-signature');
// Retrieve the Xero payload body
import beatbox
import datetime
SANDBOX = True
USERNAME = '[email protected]'
PASSWORD = 'google12'
sf = beatbox._tPartnerNS
svc = beatbox.Client()
if SANDBOX:
import xml.etree.ElementTree as xml
import csv
import sys
def run(filename):
"""
Run the CSV output script
"""
import xml.etree.ElementTree as xml
import csv
import sys
# Take the filename from the argument passed to the script
filename = sys.argv[1]
# Need to wrap the XML file in opening and closing tags
with open(filename) as f:
xml_content = f.read()
import random
import time
def assign_teams(pool):
"""
Assign a team to the players, based on the Pool
"""
player_to_team_allocation = {}
@benedwards44
benedwards44 / get_data.py
Last active November 25, 2018 10:21
Get Data from Salesforce
from simple_salesforce import Salesforce
import pytz
import datetime
CLIENT_ID = '3MVG959Nd8JMmavRjCqjEGuLnGzR.CNuRMjOLwZKB_5gIxL0CvEXzU6Rqpf6pjdHu3cJXVvyYVrCwrxyLRy_i'
SANDBOX = True
USERNAME = '[email protected]'
PASSWORD = 'google12'
sf = Salesforce(