Skip to content

Instantly share code, notes, and snippets.

View darshilv's full-sized avatar

Darshil Vora darshilv

  • San Francisco, CA
View GitHub Profile
@darshilv
darshilv / DebugEmail
Created April 8, 2013 20:37
Sending email on exception generation when all debug methods are exhausted
try{
//statements that might generate exceptions
} catch (Exception e) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {''};
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setSubject('Exception');
mail.setBccSender(false);
@darshilv
darshilv / Dynamic-SObject-Query
Last active December 20, 2015 16:19
Function to query all the fields of an SObject in Salesforce
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.<<Object_API_Name>>.fields.getMap();
//constructing a set of fieldnames
Set<String> keySet = fieldMap.keySet();
String soql = 'SELECT ';
for(String x : keySet) {
//this might be avoidable - will look at it in later version but currently pulls in the API Field name
Schema.DescribeFieldResult r = fieldMap.get(x).getDescribe();
//appending the fieldname to the query string
soql += r.getName() + ', ';
@darshilv
darshilv / Default Off - Select
Last active August 29, 2015 13:56
For selecting "Default Off" for all the select options in the Profile Settings in Salesforce Setup.
elems = document.getElementsByTagName("select");
for (x in elems ) {
console.log(elems[x]);
elems[x].children[1].selected = true;
}
@darshilv
darshilv / Uncheck All Perms
Created February 13, 2014 17:55
Unchecking all checkboxes for a Profile in Salesforce Setup
elems = document.getElementsByTagName("input");
for( x in elems ){
if(elems[x].type == "checkbox") elems[x].checked = false;
}
@darshilv
darshilv / LearningSass 02-26
Last active August 29, 2015 13:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// ----
/*
These are the normal comments
*/
// These wont make it to the other end
@darshilv
darshilv / Unique Arrays
Created June 13, 2014 21:05
An approach to get unique results from an array of objects having a duplicate value for a `key`.
//Object Array with duplicate data
var objArr = [{
"name": "abc"
}, {
"name": "abc"
}, {
"name": "def"
}, {
"name": "def"
}, {
@darshilv
darshilv / LoadingMessage
Last active August 29, 2015 14:14
Pre Loader / Loader Message to show up while doing ajax requests from Visualforce pages
<apex:component >
<!-- Attribute Definitions -->
<apex:attribute name="BorderColor" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="Width" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="Height" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="BackColor" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="BackColor" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="BorderSize" type="String" required="true" description=""></apex:attribute>
<apex:attribute name="ImageUrl" type="String" required="false" description=""></apex:attribute>
<apex:attribute name="Message" type="String" required="false" description=""></apex:attribute>
# Path to your oh-my-zsh installation.
export ZSH=/Users/dvora/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="cloud"
# Uncomment the following line to use case-sensitive completion.
{
"ignored_packages":
[
"Vintage"
],
"theme": "Material-Theme-Darker.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"overlay_scroll_bars": "enabled",
"line_padding_top": 3,
"line_padding_bottom": 3,
# -------------------- Create the device
# deviceType can be either "phone" or "desktop"
Framer.DeviceView.Devices["custom"] =
"deviceType": "phone"
"screenWidth": 768
"screenHeight": 442
"deviceImage": "images/Modern_TV.png"
"deviceImageWidth": 800
"deviceImageHeight": 583