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 IdStringIssueTrigger on Lead (after insert) { | |
String leadId = Trigger.new[0].Id; | |
SObject so = [SELECT Id, FirstName, LastName FROM Lead WHERE Id = :leadId]; | |
if(so.get('FirstName') instanceof Id) { | |
Trigger.new[0].FirstName.addError('Apex thinks this is an ID!!!'); // errors always | |
} | |
} |
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 class ScheduledJob implements Schedulable { | |
global void execute(SchedulableContext sc) { | |
System.debug('Executing'); | |
} | |
global static void schedule() { | |
ScheduledJob job = new ScheduledJob(); | |
System.schedule('Test Job', '0 0 13 * * ?', job); | |
} |
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 OpportunityTrigger on Opportunity (before insert, before update, before delete, | |
after insert, after update, after delete, after undelete) { | |
(new OpportunityTriggerHandler()).run(); | |
} |
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
// return the value of $ back to it's original owner | |
jQuery.noConflict(); | |
(function($) { | |
// code | |
}(jQuery)); |
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 class CampaignMemberTouch implements Schedulable{ | |
global void execute(SchedulableContext SC) { | |
// kick off the batch with a size of 2 for the batch size | |
InvokeTriggerBatch.invoke('SELECT Id FROM CampaignMember', 5); | |
} | |
} |
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
var crypto = require('crypto'); | |
// canvas signed request midddleware for express | |
module.exports = function(options) { | |
if(!options) options = {}; | |
function verify(signature, context) { | |
if(!options.consumerSecret) return false; | |
var hmac = crypto.createHmac('sha256', options.consumerSecret); |
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
module.exports = function(grunt) { | |
// project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
jshint: { | |
options: { | |
globals: { | |
jQuery: true, | |
console: true, |
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
{ | |
"name": "pollhouse", | |
"version": "0.0.0", | |
"description": "Poll my house, let me know when power is on", | |
"main": "poll.js", | |
"dependencies": { | |
"request": "~2.12.0", | |
"optimist": "~0.3.5", | |
"mailer": "~0.6.7" | |
} |
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
# RETURN ASTERISK WHEN CHANGES ARE PRESENT BUT UNSTAGED | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
# GET THE CURRENT GIT BRANCH | |
function parse_git_branch() { | |
if [ -d "./.git" ]; then | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
fi |
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
app.use(function(req, res, next) { | |
if(!req.session.oauth) res.redirect('/authorize'); | |
else next(); | |
}); |