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
options = { :body => | |
{ :username => 'my', | |
:password => 'password' | |
} | |
} | |
results = HTTParty.post("http://api.topcoder.com/v2/auth", options) | |
## | |
## example for post with papertrail and basic auth | |
## |
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
This simple controller (without CRUD and FLS) ... | |
public with sharing class AccountController { | |
@AuraEnabled | |
public static List<Account> findAll() { | |
return [SELECT id, name, Location__Latitude__s, Location__Longitude__s | |
FROM Account | |
WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL | |
LIMIT 50]; |
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 'jwt' | |
require "faraday" | |
require "uri" | |
def token | |
private_key = './keys/server.key' | |
priv_key = OpenSSL::PKey::RSA.new(File.read(private_key)) | |
JWT.encode payload, priv_key, 'RS256' | |
end |
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
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({ |
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 githubapi = require("github"), | |
async = require("async"), | |
AWS = require('aws-sdk'), | |
secrets = require('./secrets.js'); | |
// the 'handler' that lambda calls to execute our code | |
exports.handler = function(event, context) { | |
// config the sdk with our credentials | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html |
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
source 'https://rubygems.org' | |
gem 'restforce', '~> 6.2.2' | |
gem 'thor' |
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
import Foundation | |
import XCPlayground | |
XCPSetExecutionShouldContinueIndefinitely() | |
/** | |
* Paste all the code from the following file | |
- https://github.com/lingoer/SwiftyJSON/blob/master/SwiftyJSON/SwiftyJSON.swift | |
**/ |
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 AnimalsCallouts { | |
public static HttpResponse makeGetCallout() { | |
Http http = new Http(); | |
HttpRequest request = new HttpRequest(); | |
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals'); | |
request.setMethod('GET'); | |
HttpResponse response = http.send(request); | |
// If the request is successful, parse the JSON response. | |
if(response.getStatusCode() == 200) { | |
// Deserializes the JSON string into collections of primitive data types. |
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
const jsforce = require('jsforce'); | |
const { exec } = require('child_process'); | |
exec("sfdx org display --json", (error, stdout, stderr) => { | |
let org = JSON.parse(stdout); | |
console.log('================='); | |
console.log(org.result.username); | |
console.log(org.result.instanceUrl); | |
console.log('================='); |
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 'openssl' | |
require 'base64' | |
private_key = File.read("./salesforce_private.key") | |
public_key = File.read("./salesforce_public.key") | |
data = "reports50" | |
priv_key = OpenSSL::PKey::RSA.new(private_key) | |
signature = priv_key.sign_pss("RSA-SHA512", data, salt_length: :digest, mgf1_hash: "RSA-SHA512") |
NewerOlder