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
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'] |
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
<!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"> |
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 ChatterUtils { | |
// makes a simple chatter text post to the specified user from the running user | |
public static void simpleTextPost(Id userId, String postText) { | |
ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile; | |
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput(); | |
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>(); | |
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
<script> | |
// in the html page | |
angular.module('config', []).constant('APIKEY',''5250738f97ce29c219000011''); | |
</script> | |
myApp.controller('JobsCtrl', ['$scope', 'Jobs', 'APIKEY', function($scope, Jobs, apiKey) { | |
var promise = Jobs(apiKey).query().$promise; | |
// do more awesome programming | |
} |
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 Q = require("q"), | |
request = require('request'); | |
// call with the following | |
// var apexClassId = "01pi0000004kbvAAAQ"; // the id of the apex class to update | |
// var newCode = "public class Test1 { public void sayHelloOnceAgain() { } }"; // pass in some code | |
// var connetion = resp object from nforce org.authenticate | |
function updateApex(apexClassId, newCode, connection) { |
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 nforce = require('nforce'), | |
tooling = require('nforce-tooling')(nforce); | |
var sfuser = username | |
var sfpass = password; | |
var org = nforce.createConnection({ | |
clientId: '3MVG9A2kN3Bn17ht1YQvQ6nm.jFel8rlyJZmshbAk1q2jOWva9KnNpzRoTR5n2LxulHbXMm0UucBJiOk_Rx7b', | |
clientSecret: '4527253748424741492', | |
redirectUri: 'http://localhost:3000/oauth/_callback', |
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 allPromise = Q.all([ getTemplates(), getGroups() ]) | |
allPromise | |
.then(function (data) { | |
console.log(data); | |
}); | |
function getTemplates () { | |
var deferred = Q.defer() | |
Template.find({}, function (err, data) { | |
if (err) deferred.reject(err) // rejects the promise with `er` as the reason |
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 nforce = require('nforce'); | |
/** | |
* Salesforce configuration. | |
*/ | |
var org = nforce.createConnection({ | |
clientId: process.env.SFDC_CLIENT_ID, | |
clientSecret: process.env.SFDC_CLIENT_SECRET, | |
redirectUri: 'http://localhost:3000/oauth/_callback', |
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
<apex:page standardController="Contact" tabStyle="Contact" extensions="UploadAttachmentController"> | |
<apex:sectionHeader title="{!Contact.Name}" subtitle="Attach File"/> | |
<apex:form id="form_Upload"> | |
<apex:pageBlock > | |
<apex:pageBlockButtons > | |
<apex:commandButton action="{!back}" value="Back to {!Contact.Name}"/> | |
<apex:commandButton action="{!back}" value="Cancel"/> |
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
require 'csv' | |
require 'httparty' | |
CSV.foreach('/Users/jeff/Desktop/names.csv', :headers => false) do |row| | |
response = HTTParty.get("http://api.topcoder.com/v2/users/#{row.first}") | |
puts "#{response['handle']},#{response['country']}" | |
end |