Skip to content

Instantly share code, notes, and snippets.

View tvaidyan's full-sized avatar
💭
Hello world!

Tom Vaidyan tvaidyan

💭
Hello world!
View GitHub Profile
@tvaidyan
tvaidyan / webdev_online_resources.md
Created July 24, 2018 14:05 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
-- Code to generate INSERT statements from query results. Got this from:
-- https://stackoverflow.com/questions/4526461/converting-select-results-into-insert-script-sql-server
CREATE PROCEDURE sp_generate_insertscripts
(
@TABLENAME VARCHAR(MAX),
@FILTER_CONDITION VARCHAR(MAX)=''
)
AS
BEGIN
@tvaidyan
tvaidyan / ClaimController.apxc
Created May 14, 2021 15:51
A Salesforce Apex Class defining a REST API
@RestResource(urlMapping='/v1/claim/')
global class ClaimController {
@httpGet
global static List<Claim__c> GetClaims(){
List<Claim__c> claims = new List<Claim__c>();
claims = [Select Name, FirstName__c, LastName__c, FavoriteColor__c From Claim__c];
return claims;
}
@httpDelete
@tvaidyan
tvaidyan / AnimalLocator.cls
Created May 20, 2021 10:55
Salesforce Trailhead > APEX Integration Services > Apex REST Callouts
public class AnimalLocator {
public static string getAnimalNameById(Integer id){
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + id);
request.setMethod('GET');
HttpResponse response = http.send(request);
string animalName = null;
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
using ImageMagick;
...
using var heicImage = new MagickImage(@"C:\my-heic-file.heic");
heicImage.Write(@"C:\my-new-jpg-file.jpg");
@tvaidyan
tvaidyan / DemoTriggerHandler.cls
Created September 15, 2021 02:33
A Hello World Apex HTTP Callout Example
public class DemoTriggerHandler {
@future (callout=true)
public static void sendTestRequest(string field1, string field2, string field3) {
try{
HttpRequest request = new HttpRequest();
request.setMethod('POST');
request.setEndpoint("my external api url goes here");
request.setBody('{"message":"Hello World"}');
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)