Skip to content

Instantly share code, notes, and snippets.

Currently being awesome

Jeff Douglas jeffdonthemic

Currently being awesome
Block or report user

Report or block jeffdonthemic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jeffdonthemic / restforce.rb
Created Jan 24, 2020
Restforce monkey patch
View restforce.rb
module Restforce
class Mash < Hashie::Mash
class << self
def klass(val)
if val.key? 'records'
# When the hash has a records key, it should be considered a collection
# of sobject records.
jeffdonthemic / app.rb
Last active Sep 3, 2019
Refresh Token from Salesforce
View app.rb
require 'sinatra'
require 'omniauth'
require 'omniauth-salesforce'
rescue LoadError
require 'rubygems'
require 'sinatra'
require 'omniauth'
require 'omniauth-salesforce'
View org_connection.js
const jsforce = require('jsforce');
const jwt = require("salesforce-jwt-bearer-token-flow");
// create the connection to the org
let conn = new jsforce.Connection();
// load the private key for the token
let privateKey = require('fs').readFileSync('./server.key', 'utf8');
jeffdonthemic / gist:e735a32350d8c54b27caf2d8ed95cd71
Created Jan 28, 2019
View gist:e735a32350d8c54b27caf2d8ed95cd71
Account a = new Account(name='Astro Chicken & Ribs Joint', BillingState='NY', ShippingState='NY', Type='Customer - Channel');
insert a;
Opportunity opp = new Opportunity(AccountId=a.Id,Name='Sell some chicken salad', StageName='Closed Won', Amount=99999,;
insert opp;
// ensure the flow ran successfully
System.assertEquals(1, [select count() from Robot_Setup__c where Opportunity__c = :opp.Id]);
// check the date
List<Robot_Setup__c> rs = [select id, date__c from Robot_Setup__c where Opportunity__c = :opp.Id limit 1];
System.assert([0].Date__c) >= 179);
// update so we can delete the opp
View app.js
function openModal(name) {
function closeModal(name) {
View Trailhead_User__c.object
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="">
View Create Category Items
// create the association object with the final data
associations = {
"elements": elements
// create all of the associations
url: ''+process.env.CLOVER_MERCHANT_ID+'/category_items',
method: 'POST',
headers: {
View Elements array
[ { name: '1.21 Jigahops',
item: { id: 'HE8F2FX7Y1SVP' },
category: { id: 'QQ45R3PMHK9SW' } },
{ name: '100% Brett IPA',
item: { id: 'M8NHD9BAKZ8YP' },
category: { id: 'QQ45R3PMHK9SW' } },
{ name: '41 Red',
item: { id: 'K7BZ8YZGRNA9C' },
category: { id: 'QQ45R3PMHK9SW' } },
{ name: 'All About Mango Pale Ale',
View List to Set<Id>
List<Product2> products = [select id, name from product2 where productcode = 'foo'];
Set<Id> ids = (new Map<Id,Product2>(products)).keySet();
jeffdonthemic / bulk-api.json
Created May 25, 2016
Trailhead Bulk API JSON Import
View bulk-api.json
"name": "Insuron Bulk Company"
"name": "Orboid Bulk Company"
"name": "Bovis Bulk Company"
You can’t perform that action at this time.