Skip to content

Instantly share code, notes, and snippets.

💭
Currently being awesome

Jeff Douglas jeffdonthemic

💭
Currently being awesome
Block or report user

Report or block jeffdonthemic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeffdonthemic
jeffdonthemic / gist:2146052
Created Mar 21, 2012
MemberRestSvc - Apex REST Service (v24)
View gist:2146052
@RestResource(urlMapping='/v.9/member/*/results/*')
global with sharing class MemberRestSvc {
@HttpGet
global static ReturnClass doGet() {
String[] uriKeys = RestContext.request.requestURI.split('/');
// get the member name from the uri
String memberName = uriKeys.get(uriKeys.size()-3);
@jeffdonthemic
jeffdonthemic / gist:2146160
Created Mar 21, 2012
Test_MemberRestSvc - Test Class for Apex REST Service (v24)
View gist:2146160
@isTest
private class Test_MemberRestSvc {
static {
// setup test data
}
static testMethod void testDoGet() {
RestRequest req = new RestRequest();
@jeffdonthemic
jeffdonthemic / gist:2146168
Created Mar 21, 2012
Test_MemberRestSvc - Test Class for Apex REST Service (v23)
View gist:2146168
@isTest
private class Test_MemberRestSvc {
static {
// setup test data
}
static testMethod void testDoGet() {
RestRequest req = new RestRequest();
@jeffdonthemic
jeffdonthemic / AccountRegionTriggerHandler
Created Apr 10, 2012
AccountRegionTrigger, Handler and Test class
View AccountRegionTriggerHandler
public with sharing class AccountRegionTriggerHandler {
@future
public static void ProcessRegionsAsync(Set<ID> accountIds){
// holds a map of the account id and comma separated regions to build
Map<Id, String> accountRegionMap = new Map<Id, String>();
// get ALL of the regions for all affected accounts so we can build
List<Account_Region__c> accountRegions = [select id, Account__c,
@jeffdonthemic
jeffdonthemic / gist:2508492
Created Apr 27, 2012
Force.com Node.js Demo - app.js
View gist:2508492
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, rest = require('./rest.js')
, oauth = require('./oauth.js')
, url = require('url');
@jeffdonthemic
jeffdonthemic / gist:2508501
Created Apr 27, 2012
Force.com Node.js Demo - routes/index.js
View gist:2508501
// only needed if calling the rest api from this file (accounts route)
var rest = rest = require('./../rest.js');
/*
* GET home page.
*/
exports.index = function(req, res){
res.render('index', { title: 'Salesforce.com Node.js REST Demo' })
};
View gist:2567190
require 'databasedotcom'
class Utils < Thor
desc "query SOQL", "runs a soql query and displays the value of each record's 'name' field"
method_option :config_file, :type => :string, :default => "databasedotcom.yml",
:aliases => "-c", :desc => "The name of the file containing the connection parameters."
def query(soql)
client = authenticate(options[:config_file])
# execute the soql and iterate over the results to output the name
View gist:2567200
client_id: YOUR-CLIENT-ID
client_secret: YOUR-CLIENT-SECRET
host: test.salesforce.com
debugging: false
username: YOUR-USERNAME
password: YOUR-PASSWORD
@jeffdonthemic
jeffdonthemic / gist:3485039
Created Aug 27, 2012
node-force-demo app.js
View gist:3485039
var express = require('express')
, routes = require('./routes')
, util = require('util')
. async = require('async')
, nforce = require('nforce');
var port = process.env.PORT || 3001; // use heroku's dynamic port or 3001 if localhost
var oauth;
// use the nforce package to create a connection to salesforce.com
@jeffdonthemic
jeffdonthemic / force-node-streaming-app.js
Created Sep 7, 2012
Streaming API example with nforce
View force-node-streaming-app.js
/**
* Module dependencies.
*/
var config = require('./config.js');
var express = require('express')
, faye = require('faye')
, nforce = require('nforce')
, util = require('util')
, routes = require('./routes');
You can’t perform that action at this time.