Salesforce Developer Workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require "Salesforce.class.nut:1.1.0" | |
#require "Rocky.class.nut:1.2.3" | |
#require "bullwinkle.class.nut:2.3.0" | |
#require "promise.class.nut:3.0.0" | |
// EXTEND SALESFORCE CLASS TO HANDLE OAUTH 2.0 | |
// ---------------------------------------------------------- | |
class SalesforceOAuth2 extends Salesforce { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//window.location.href = "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_bright <- 0.5; | |
current_scene <- 2; | |
const low_scene = 0; | |
const high_scene = 3; | |
const lowest_bright = 0.0; | |
const highest_bright = 1.0; | |
const bearer = "YOURBEARERIDS"; | |
related_scenes <- [IFNEEDED+YOURSCENEIDSHERE]; | |
function motion(data) { | |
if(data.dir == "TAP") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function motion(direction) { | |
server.log(direction); | |
} | |
device.on("direction.sent", motion); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var plumb = (function (initial_data) { | |
// Properties | |
/////////////////////////// | |
var raw_data = []; | |
var data = []; | |
var load = function(raw_data,data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/token',function (req, res) { | |
console.log(req.body); | |
var sr = sync_request('POST', 'https://login.salesforce.com/services/oauth2/token', | |
{ | |
headers: {'Content-Type':'application/x-www-form-urlencoded','Accept':'application/json'}, | |
body: 'grant_type='+req.body.grant_type+'&code='+req.body.code+'&refresh_token='+req.body.refresh_token+'&client_id='+req.body.client_id+'&client_secret='+req.body.client_secret+'&redirect_uri='+req.body.redirect_uri | |
}); | |
console.log(sr.getBody('utf8')); | |
response = JSON.parse(sr.getBody('utf8')); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class SpeedTestController { | |
@AuraEnabled | |
public static List< SpeedTest__c > getData() { | |
List<SpeedTest__c> speeds = [SELECT ID, TimeString__c,Download__c,Upload__c from SpeedTest__c LIMIT 1000]; | |
return speeds; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DestroyAllTheThings { | |
public DestroyAllTheThings() {} | |
public void destroySimpleCRMStuff() { | |
//First clear out known dependents, leads and cases etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger RejectDoubleBooking on Session_Speaker__c (before insert, before update) { | |
//collect ID's in one list to reduce SOQL | |
List<Id> speakerIds = new List<Id>(); | |
Map<Id,DateTime> requested_bookings = new Map<Id,DateTime>(); | |
//get all speakers related to the trigger | |
for(Session_Speaker__c newItem : trigger.new) { | |
requested_bookings.put(newItem.Session__c,null); | |
speakerIds.add(newItem.Speaker__c); |
NewerOlder