View index.js
var githubapi = require("github"), | |
async = require("async"), | |
AWS = require('aws-sdk'), | |
secrets = require('./secrets.js'); | |
// the 'handler' that lambda calls to execute our code | |
exports.handler = function(event, context) { | |
// config the sdk with our credentials | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html |
View CustomAccountLookup.page
<apex:page controller="CustomAccountLookupController" | |
title="Search" | |
showHeader="false" | |
sideBar="false" | |
tabStyle="Account" | |
id="pg"> | |
<apex:form > | |
<apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;"> | |
<apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel"> |
View UploadAttachment
<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"/> |
View app.js
var http = require('http'), | |
fs = require('fs'), | |
// NEVER use a Sync function except at start-up! | |
index = fs.readFileSync(__dirname + '/index.html'); | |
// Send index.html to all requests | |
var app = http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end(index); | |
}); |
View org_connection.js
const jsforce = require('jsforce'); | |
const jwt = require("salesforce-jwt-bearer-token-flow"); | |
// create the connection to the org | |
let conn = new jsforce.Connection(); | |
// load the private key for the token | |
let privateKey = require('fs').readFileSync('./server.key', 'utf8'); | |
jwt.getToken({ |
View httparty.rb
options = { :body => | |
{ :username => 'my', | |
:password => 'password' | |
} | |
} | |
results = HTTParty.post("http://api.topcoder.com/v2/auth", options) | |
## | |
## example for post with papertrail and basic auth | |
## |
View gist:7247654
<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 | |
} |
View do_magic.rb
# This code is based upon the following links: | |
# https://developer.github.com/v3/git/trees/ | |
# https://github.com/testcollab/rails-test | |
# https://stackoverflow.com/questions/23637961/how-do-i-mark-a-file-as-deleted-in-a-tree-using-the-github-api | |
# https://github.community/t/deleting-files-via-trees-no-longer-works/14042 | |
# This creates a signed commit on the correct branch, but there are 0 changed files. | |
# THIS IS THE METHOD THAT IS CALLED BY THE MAIN PROCESS TO REMOVE FILES |
View do_magic.rb
# https://github.community/t/deleting-files-via-trees-no-longer-works/14042 | |
def commit_files_to_remove | |
# get the base branch tree that has all of the files in it | |
branch_tree = github.git_data.trees.get @repo.username, | |
@repo.repo_name, | |
new_branch_sha, | |
recursive: true | |
# select only the files for THIS badge |
View restforce.rb
module Restforce | |
class Mash < Hashie::Mash | |
class << self | |
def klass(val) | |
if val.key? 'records' | |
# When the hash has a records key, it should be considered a collection | |
# of sobject records. | |
Restforce::Collection |
NewerOlder