Skip to content

Instantly share code, notes, and snippets.

@sechastain
sechastain / QuickJSQuestion.js
Created May 28, 2019 16:30 — forked from lukealbao/QuickJSQuestion.js
Quick JS Question
var inventory = {
'000001': {
name: 'Banana Slicer',
price: 2.99
},
'000002': {
name: 'Three Wolves Tea Cozy',
price: 14.95
}
};
@sechastain
sechastain / gist:eaa2996a0a91223931d4
Created November 11, 2014 15:16
Salesforce Apex List Required Fields
SObjectType sot = Your_Custom_Object__c.SObjectType;
Map<String, SObjectField> fields = sot.getDescribe().fields.getMap();
for(String k : fields.keyset()) {
DescribeFieldResult dfr = fields.get(k).getDescribe();
if(!dfr.isNillable()) {
System.debug('REQUIRED FIELD: ' + k);
}
}
@sechastain
sechastain / gist:65e01b0c040b7f52a7ae
Created September 19, 2014 19:37
Salesforce Apex List all Object Type Name, Fields, and Values given a record id (for dev console)
String oid = '';
SObject obj = [select id from task where id = :oid ];
String objType = obj.getSObjectType().getDescribe().getName();
System.debug('loading fields');
List<String> accessibleFields = new List<String>();
Map<String, Schema.SobjectField> fields = obj.getSObjectType().getDescribe().fields.getMap();
@sechastain
sechastain / IntegrationUtils.scala
Created March 25, 2014 17:30
Gatling Integration Util
import java.util.concurrent.TimeUnit
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.request.builder._
import io.gatling.core.session._
import io.gatling.http.check.HttpCheck
import io.gatling.http.request.StringBody
import io.gatling.core.structure.{PopulatedScenarioBuilder, ChainBuilder}