Skip to content

Instantly share code, notes, and snippets.

View jeffdonthemic's full-sized avatar
💭
Currently being awesome

Jeff Douglas jeffdonthemic

💭
Currently being awesome
View GitHub Profile
@jeffdonthemic
jeffdonthemic / gist:2146168
Created March 21, 2012 10:56
Test_MemberRestSvc - Test Class for Apex REST Service (v23)
@isTest
private class Test_MemberRestSvc {
static {
// setup test data
}
static testMethod void testDoGet() {
RestRequest req = new RestRequest();
@jeffdonthemic
jeffdonthemic / AccountRegionTriggerHandler
Created April 10, 2012 13:41
AccountRegionTrigger, Handler and Test class
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 April 27, 2012 11:21
Force.com Node.js Demo - app.js
/**
* 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 April 27, 2012 11:23
Force.com Node.js Demo - routes/index.js
// 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' })
};
@jeffdonthemic
jeffdonthemic / gist:2567200
Created May 1, 2012 10:44
CLI - yaml file
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:2567190
Created May 1, 2012 10:43
CLI - thor file
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
@jeffdonthemic
jeffdonthemic / gist:3485039
Created August 27, 2012 02:13
node-force-demo app.js
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
<aura:component >
<aura:attribute name="DayOfTheWeek" type="String"/>
<aura:if isTrue="{!v.DayOfTheWeek == 'Monday'}">
Today is Monday
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Tuesday'}">
Today is Tuesday
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Wednesday'}">
Today is Wednesday
@jeffdonthemic
jeffdonthemic / streaming.rb
Created January 16, 2013 14:45
Streaming API example with restfroce
require 'restforce'
require 'faye'
# Initialize a client with your username/password.
client = Restforce.new :username => ENV['SFDC_USERNAME'],
:password => ENV['SFDC_PASSWORD'],
:security_token => ENV['SFDC_SECURITY_TOKEN'],
:client_id => ENV['SFDC_CLIENT_ID'],
:client_secret => ENV['SFDC_CLIENT_SECRET']
@jeffdonthemic
jeffdonthemic / application.html.erb
Created June 8, 2013 00:43
angular-rails-salesforce-demo views/layouts/application.html.erb
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<title>Angular Salesforce Demo</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="container">