View do_magic.rb
# This code is based upon the following links: | |
# https://developer.github.com/v3/git/trees/ | |
# https://github.com/testcollab/rails-test | |
# https://stackoverflow.com/questions/23637961/how-do-i-mark-a-file-as-deleted-in-a-tree-using-the-github-api | |
# https://github.community/t/deleting-files-via-trees-no-longer-works/14042 | |
# This creates a signed commit on the correct branch, but there are 0 changed files. | |
# THIS IS THE METHOD THAT IS CALLED BY THE MAIN PROCESS TO REMOVE FILES |
View do_magic.rb
# https://github.community/t/deleting-files-via-trees-no-longer-works/14042 | |
def commit_files_to_remove | |
# get the base branch tree that has all of the files in it | |
branch_tree = github.git_data.trees.get @repo.username, | |
@repo.repo_name, | |
new_branch_sha, | |
recursive: true | |
# select only the files for THIS badge |
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. | |
Restforce::Collection |
View app.rb
begin | |
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'); | |
jwt.getToken({ |
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 |
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'); | |
} |
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> |
View Create Category Items
// create the association object with the final data | |
associations = { | |
"elements": elements | |
} | |
// create all of the associations | |
request({ | |
url: 'https://api.clover.com:443/v3/merchants/'+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', |
NewerOlder