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 with sharing class ApexDmlUtil { | |
public void processSaveResults(List<Database.SaveResult> results) { | |
List<String> errors; | |
for (Database.SaveResult r : results) { | |
if (!r.isSuccess()) { | |
RAL_MetricService.increment(RAL_MetricService.Metric.Errored, this.file.Id); | |
errors = new List<String>(); | |
for (Database.Error e : r.errors) { | |
errors.add(e.message); | |
} |
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
env.sh | |
*.git |
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
// Using Crypto for a Random string | |
nickname += String.valueOf(Crypto.getRandomInteger()).substring(1,7); | |
// Using Crypto to create a GUID | |
// TODO |
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
# Creates alias which does the following: | |
# 1. Changes to master branch | |
# 2. Performs a fetch | |
# 3. Attempts to delete branches which have been removed from remote | |
# 4. Performs a verbose branch list | |
alias gitclean="git checkout master; git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done; git branch -vv" |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>BackgroundAlphaInactive</key> | |
<real>0.80000000000000004</real> | |
<key>BackgroundColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T |
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 DelegateApex { | |
public interface SObjectDelegate { | |
List<SObject> getObject(String search); | |
} | |
public class AccountDelegate implements SObjectDelegate { | |
public List<SObject> getObject(String searchVar) { | |
List<Account> accounts = [SELECT Id, Name | |
FROM Account |
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
global with sharing class ApexDeprecated { | |
@Deprecated | |
global enum FOOBAR { FOO, BAR } | |
// Not Allowed - Deprecated FOOBAR return type illegal in global | |
global static FOOBAR bar(Integer ord) { | |
return FOOBAR.values()[ord]; | |
} | |
// Allowed - Deprecated type is not exposed globally, so can still be used internal to the method |
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
/** | |
* Checks and converts strings when they contain accounting negative format ($1,000.00) | |
* to standard negative format -$1,000.00 | |
* | |
* @param str Input String to evaluate | |
* | |
* @return String containing converted value, or original value if there was no match found | |
*/ | |
public static String toStandardNegative(String str) { | |
Pattern negPattern = Pattern.compile('^\\((.+)\\)$'); |
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
function undentBlock(block) { | |
let REGEX_INDEX = /^[ \t]*\**[ \t]+/g; | |
let indent = null; | |
block.split("\n").forEach(function (line) { | |
let match = line.match(REGEX_INDEX); | |
let cur = match !== null ? match[0].replace(/\*/g, "").length : null; | |
if (cur < indent || indent === null) indent = cur; | |
}); | |
let ret = ""; | |
block.split("\n").forEach(function (line) { |
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 with sharing class ParseEmailHeaders { | |
public Map<String, String> parseEmailHeaders(String headers) { | |
Map<String, String> headersMap = new Map<String, String>(); | |
List<String> rows = headers.split('\n'); | |
for (String row : rows) { | |
Integer div = row.indexOf(':'); | |
String rowKey = row.substring(0, div).trim(); | |
String rowValue = row.substring(div + 1, row.length()).trim(); | |
String existingValue = headersMap.get(rowKey); | |
if (existingValue != null) { |
OlderNewer