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
trigger CaseTrigger on Case (after insert) { | |
ObjectSnapshotUtils.createSnapshots(Trigger.new); | |
} |
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 would actually be your CaseTrigger.trigger but the hilighting wouldn't work then | |
List<ChatterPost> postsToInsert = new List<ChatterPost>(); | |
for (Case c: trigger.new) { | |
if (c.Status == 'collab') { | |
postsToInsert.add(new ChatterPost(...)); | |
} | |
if (!postsToInsert.isEmpty()) { |
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
Map<String, Profile> profileMap { | |
get { | |
if (profileMap == null) { | |
profileMap = new Map<String, Profile>(); | |
for (Profile p: [ | |
select Name | |
from Profile | |
]) { | |
profileMap.put(p.Name, p); |
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 static String extractRefId(String orgId, String testString) { | |
pattern myPattern = pattern.compile('(?m).*\\[ ref:(.*)\\.(.*):ref \\].*'); | |
matcher myMatcher = myPattern.matcher(testString); | |
if (myMatcher.matches()) { | |
if (myMatcher.group(1) == orgId) { | |
return myMatcher.group(2); | |
} | |
} | |
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
//Agent code | |
function send_pushover(title, message, priority) { | |
local url = "https://api.pushover.net/1/messages.json"; | |
local token="XXX_TOKENGOESHERE_XXX"; | |
local user="XXX_USERGOESHERE_XXX"; | |
local headers = { "Content-Type": "application/x-www-form-urlencoded" }; | |
local data = { | |
"token": token, | |
"user": user, | |
"message": 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
/** | |
* Utility methods for use with the Object Snapshot object | |
* | |
* @author Patrick Connelly | |
*/ | |
public with sharing class ObjectSnapshotUtils { | |
public static String JSON_DELIMITER = '[delimiter]'; | |
public static Integer JSON_FIELD_SIZE = 32768 - (JSON_DELIMITER.length() * 2); | |
public static Integer JSON_FIELD_COUNT = 10; |
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
/** | |
* Sleep at least a second | |
* | |
* Found at: http://boards.developerforce.com/t5/Apex-Code-Development/Best-way-to-delay-until-time-changes-in-a-test/td-p/389619 | |
* | |
*/ | |
public static void waitAtLeastASecond() { | |
Integer msPerS = 1000; | |
Datetime start = Datetime.now(); | |
Datetime current = Datetime.now(); |
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
# | |
# Define some colors first: Capitals denote bold | |
# | |
red='\e[0;31m' | |
RED='\e[1;31m' | |
green='\e[0;32m' | |
GREEN='\e[1;32m' | |
yellow='\e[0;33m' | |
YELLOW='\e[1;33m' | |
blue='\e[0;34m' |
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
/*jslint browser: true, regexp: true */ | |
/*global casper, require, jQuery*/ | |
var BASE_URL, LOGIN_URL, LOGIN_USERNAME, LOGIN_PASSWORD, SCHEDULED_JOBS_URI, casp; | |
casp = require('casper').create({ | |
clientScripts: [ | |
'jquery.min.js' | |
], | |
viewportSize: { |
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
/*jslint browser: true, regexp: true */ | |
/*global casper, require */ | |
var LOGIN_URL, LOGIN_USERNAME, LOGIN_PASSWORD, casp; | |
casp = require('casper').create({ | |
viewportSize: { | |
width: 1024, | |
height: 768 | |
}, |