View decodeIdToken.js
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
var jwt = require('jwt-simple'); | |
var getpem = require('rsa-pem-from-mod-exp'); | |
// Decode JWT token, verify with the relevant key from the supplied | |
// array | |
function decodeIdToken(idtoken, keys, code) { | |
var header = JSON.parse(new Buffer(idtoken.split('.')[0], 'base64').toString('utf8')); | |
for (var i = 0; i < keys.length; i++) { | |
if (keys[i].kid === header.kid) { |
View CaseUpload.page
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
<apex:page controller="CreateCaseCon" docType="html-5.0" showHeader="false"> | |
<style> | |
html, body { | |
height: 100%; | |
} | |
h3 { | |
display: block; | |
margin-top: 30px; | |
margin-bottom: 10px; |
View PatTest.cls
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 PatTest { | |
public static void queryAllFields(String objTypeName) { | |
Schema.DescribeSObjectResult[] descResult = | |
Schema.describeSObjects(new String[]{objTypeName}); | |
Map<String, Schema.SObjectField> fsMap = descResult[0].fields.getMap(); | |
List<String> fieldNames = new List<String>(fsMap.keySet()); | |
String queryString = 'SELECT '+String.join(fieldNames, ',')+' FROM Account LIMIT 1'; | |
SObject obj = Database.query(queryString); |
View GoogleRegHandler.cls
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
// Registration handler to create internal users from a Google social sign-on | |
global class GoogleRegHandler implements Auth.RegistrationHandler{ | |
global boolean canCreateUser(Auth.UserData data) { | |
// TODO: Check whether you want to allow creation of a user with this data | |
// e.g. test the domain name on the email address, or check some list | |
// somewhere, and return true as appropriate | |
return false; | |
} | |
View app.js
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
var Twitter = require('twitter'); | |
var pg = require('pg'); | |
var tw = new Twitter({ | |
consumer_key: process.env.TWITTER_CONSUMER_KEY, | |
consumer_secret: process.env.TWITTER_CONSUMER_SECRET, | |
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY, | |
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET, | |
}); |
View Agent
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.0.0" | |
force <- Salesforce("CLIENT_ID_GOES_HERE", | |
"CLIENT_SECRET_GOES_HERE"); | |
USERNAME <- "user@example.com"; | |
PASSWORD <- "p455w0rd"; | |
SECURITY_TOKEN <- "s3cr3t"; | |
force.login(USERNAME, PASSWORD, SECURITY_TOKEN, function(err, data) { |
View Agent
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.0.0" | |
CLIENT_ID <- "CLIENT_ID_GOES_HERE"; | |
CLIENT_SECRET <- "CLIENT_SECRET_GOES_HERE"; | |
LOGIN_HOST <- "login.salesforce.com"; | |
// Uncomment to clear saved OAuth state | |
//server.save({}); | |
OAUTH <- server.load(); |
View sessionTimeout.js
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
var jsforce = require('jsforce'); | |
var unzip = require('unzip'); | |
var xml2js = require('xml2js'); | |
var sessionTimeoutSeconds = { | |
FifteenMinutes : 900, | |
ThirtyMinutes : 1800, | |
SixtyMinutes : 3600, | |
TwoHours : 7200, | |
FourHours : 14400, |
View tn.page
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
<apex:page docType="html-5.0" title="Bulk Uploader" sidebar="false"> | |
<div id="byte_content"></div> | |
<input type="file" id="files" onchange="upload()"/> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
<script src="{!$Resource.forcetk}"></script> | |
<script src="{!$Resource.jxon}"></script> | |
<script src="{!$Resource.bulkTK}"></script> | |
<script src="{!$Resource.vkbeautify}"></script> | |
<script> | |
function readBlob(opt_startByte, opt_stopByte) { |
View MetadataSample.java
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
package com.force.samples; | |
import com.sforce.soap.enterprise.Connector; | |
import com.sforce.soap.enterprise.EnterpriseConnection; | |
import com.sforce.soap.metadata.AsyncRequestState; | |
import com.sforce.soap.metadata.AsyncResult; | |
import com.sforce.soap.metadata.MetadataConnection; | |
import com.sforce.soap.metadata.Profile; | |
import com.sforce.soap.metadata.ProfileLoginIpRange; | |
import com.sforce.soap.metadata.UpdateMetadata; |
OlderNewer