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
jeffdonthemic / gist:e735a32350d8c54b27caf2d8ed95cd71
Created Jan 28, 2019
superbadge_process_automation_opportunity_automation
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, CloseDate=Date.today());
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(Date.today().daysBetween(rs[0].Date__c) >= 179);
// update so we can delete the opp
@jeffdonthemic
jeffdonthemic / CustomAccountLookup.page
Last active Jan 24, 2019
Roll Your Own Salesforce "Lookup" Popup Window blog post
View CustomAccountLookup.page
<apex:page controller="CustomAccountLookupController"
title="Search"
showHeader="false"
sideBar="false"
tabStyle="Account"
id="pg">
<apex:form >
<apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel">
View app.js
function openModal(name) {
$("#"+name).addClass('slds-fade-in-open');
$("#backdrop").addClass('slds-backdrop_open');
}
function closeModal(name) {
$("#"+name).removeClass('slds-fade-in-open');
$("#backdrop").removeClass('slds-backdrop_open');
}
@jeffdonthemic
jeffdonthemic / AddToCart.evt
Last active Sep 28, 2018
Salesforce1 Lightning Demo for Spring '15
View AddToCart.evt
<aura:event type="APPLICATION" description="Add to cart event.">
<aura:attribute name="product" type="Product__c"/>
</aura:event>
View app.js
var http = require('http');
var request = require('request');
var moment = require("moment");
var crypto = require('crypto');
var apiToken = 'MY-TOKEN';
var apiSecret = 'MY-SECRET';
var generateSession = function(userName, sessionName) {
var relativeUrl = "/services/api/sts/GenerateSession/"+userName+"/"+sessionName;
View Trailhead_User__c.object
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<actionOverrides>
<actionName>Accept</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>CancelEdit</actionName>
<type>Default</type>
</actionOverrides>
@jeffdonthemic
jeffdonthemic / gist:7247654
Last active Jan 18, 2018
Passing parameters in an Angular.js Controller to a Resource
View gist:7247654
<script>
// in the html page
angular.module('config', []).constant('APIKEY',''5250738f97ce29c219000011'');
</script>
myApp.controller('JobsCtrl', ['$scope', 'Jobs', 'APIKEY', function($scope, Jobs, apiKey) {
var promise = Jobs(apiKey).query().$promise;
// do more awesome programming
}
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',
@jeffdonthemic
jeffdonthemic / force-node-streaming-app.js
Created Sep 7, 2012
Streaming API example with nforce
View force-node-streaming-app.js
/**
* Module dependencies.
*/
var config = require('./config.js');
var express = require('express')
, faye = require('faye')
, nforce = require('nforce')
, util = require('util')
, routes = require('./routes');
View bluebird.js
var venueCheckins = function(access_token) {
return new Promise(function(resolve, reject) {
request('https://api.untappd.com/v4/thepub/local?limit=25&lat=61.146283&lng=-149.878679&access_token='+access_token, function (error, response, body) {
if (!error && response.statusCode == 200) {
var results = JSON.parse(body);
var checkins = [];
// do magic
resolve(checkins);
} else {
reject(error);
You can’t perform that action at this time.