Skip to content

Instantly share code, notes, and snippets.

View JimBTek's full-sized avatar

Jim Bartek JimBTek

View GitHub Profile
@JimBTek
JimBTek / simple-salesforce-jwt.py
Created January 3, 2023 15:45 — forked from davidmreed/simple-salesforce-jwt.py
Using simple_salesforce with JWT authentication
import jwt
import requests
import datetime
from simple_salesforce import Salesforce
from simple_salesforce.exceptions import SalesforceAuthenticationFailed
def jwt_login(consumer_id, username, private_key, sandbox=False):
endpoint = 'https://test.salesforce.com' if sandbox is True else 'https://login.salesforce.com'
jwt_payload = jwt.encode(
{
public class Account_Service{
public static void processAccounts(){
List<Account> allAccounts = [Select Id, Name, etc....]; // starting list
List<Account> accountsToUpdate = new List<Account>(); // empty list
accountsToUpdate.addAll(setOwner(allAccounts)); //return only records method1 edited
accountsToUpdate.addAll(copyAddress(allAccounts)); //return only records method2 edited
@JimBTek
JimBTek / gitflowrebasing.md
Created August 2, 2019 14:14 — forked from markreid/gitflowrebasing.md
git flow with rebasing
@JimBTek
JimBTek / SalesForceBackup.py
Created April 22, 2019 17:36 — forked from mattkatz/SalesForceBackup.py
Simple python Script to backup a salesforce instance to csv files
from simple_salesforce import Salesforce, SalesforceMalformedRequest
from argparse import ArgumentParser
from csv import DictWriter
from datetime import date
from pathlib import Path
production_instance = 'yourinstance.salesforce.com'
parser = ArgumentParser(description="Backs up all Salesforce objects to csv files")
parser.add_argument("username", help="User to authenticate as. Should be part of an 'integration_user' profile or some profile with no ip range restriction")
@JimBTek
JimBTek / AccountSelector.cls
Created April 9, 2019 18:45 — forked from gdoenlen/AccountSelector.cls
Simple dependency injection within SFDC
/**
* Selector for the `Account` entity
*/
public class AccountSelector {
public static final AccountSelector INSTANCE = new AccountSelector();
/**
* Finds all accounts that are child accounts of
* the given opportunity's account.
@JimBTek
JimBTek / VisualforceJavaScriptDesignPattern.html
Created September 26, 2018 17:37 — forked from douglascayers/VisualforceJavaScriptDesignPattern.html
Visualforce and JavaScript design pattern to handle page load and ajax rerendering events.
<apex:page extensions="SomeController">
<script src="{!$Resource.jquery224}"></script>
<script>$j = jQuery.noConflict();</script>
<apex:form>
<apex:outputPanel id="someSection">
... stuff here ...
@JimBTek
JimBTek / gist:edb0c35a5d2719b36c5c37703dbcffa9
Created February 24, 2017 15:01
Trailhead Apex method
public class AccountHandler {
public static String insertNewAccount(String acctName) {
Account acct = new Account (Name = acctName);
try{
insert acct;
Account returnAcct = [select id, Name from Account where Name = 'acctName' limit 1];
}
catch (DmlException e) {
System.debug('A DML exception has occurred: ' + e.getMessage());
}
List<Invoice> invs=[select id, count365__c from Invoice where Invoice_Date__C > 2014-04-02];
if (!invs.isEmpty())
{
Invoice inv=invs[0];
inv.count365__c=TRUE;
}
# --- Ruby ---------------------------------------------------------------------
exec { 'install_rvm':
command => "${as_vagrant} 'curl -L https://get.rvm.io | bash -s master'",
creates => "${home}/.rvm",
require => Package['curl']
}
exec { 'install_ruby':
# We run the rvm executable directly because the shell function assumes an
@JimBTek
JimBTek / gist:6340754
Created August 26, 2013 12:02
vagrantfile that keeps resetting the vm
Vagrant::Config.run do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.host_name = 'box'
config.vm.forward_port 3000, 3000
config.vm.provision :puppet,
:manifests_path => 'puppet/manifests',
:module_path => 'puppet/modules'