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
require 'restforce'
# set default org with sfdx
# sfdx config set target-org=<some username or org alias>
# grab the access token & instance url from the default scratch org using sfdx
org = JSON.parse(`sfdx org display --json`)
client = Restforce.new(
oauth_token: org['result']['accessToken'],
var venueCheckins = function(access_token) {
return new Promise(function(resolve, reject) {
request('https://api.untappd.com/v4/thepub/local?limit=25&lat=61.146283&lng=-149.878679&access_token='+access_token, function (error, response, body) {
if (!error && response.statusCode == 200) {
var results = JSON.parse(body);
var checkins = [];
// do magic
resolve(checkins);
} else {
reject(error);
@jeffdonthemic
jeffdonthemic / app.js
Last active September 4, 2018 11:34
CSOD
var http = require('http');
var request = require('request');
var moment = require("moment");
var crypto = require('crypto');
var apiToken = 'MY-TOKEN';
var apiSecret = 'MY-SECRET';
var generateSession = function(userName, sessionName) {
var relativeUrl = "/services/api/sts/GenerateSession/"+userName+"/"+sessionName;
@jeffdonthemic
jeffdonthemic / AngularDemoController.cls
Created February 6, 2015 20:37
Hello Angular Visualforce Page & Controller
global with sharing class AngularDemoController {
// hardcode an account id for demo purposes
static String accountId = '0017000001CwYz9';
global static String getAccount() {
return JSON.serialize([select name, billingstreet,
billingcity, billingstate, billingpostalcode
from account where id = :accountId][0]);
}
@jeffdonthemic
jeffdonthemic / test.go
Created February 5, 2015 17:22
Go-Force Snippets
package main
import (
"fmt"
"log"
"github.com/nimajalali/go-force/force"
"github.com/nimajalali/go-force/sobjects"
)
@jeffdonthemic
jeffdonthemic / index.js
Last active October 27, 2023 15:42
Lambda function to commit code to github. See blog post for more details.
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
@jeffdonthemic
jeffdonthemic / config.json
Created January 29, 2015 13:12
Download file from S3 to disk
{ "accessKeyId": "akid", "secretAccessKey": "secret", "region": "us-east-1" }
'use strict';
var app = angular.module('app');
app.controller('AccountDetailCtrl', function($scope, $routeParams, Account) {
$scope.account = Account.get({id:$routeParams.id});
$scope.mode = 'display';
$scope.edit = function() {
@jeffdonthemic
jeffdonthemic / ContactListViewComponent.component
Last active February 14, 2019 03:07
Code for ContactListViewComponents for enhancedList Visualforce component. http://blog.jeffdouglas.com/2014/12/12/enhancedlist-visualforce-component/
<apex:component controller="ContactListViewController">
<apex:attribute name="listViewName" type="String" required="true"
description="The name of the listview." assignTo="{!listName}"/>
<apex:enhancedList height="400" rowsPerPage="25" id="ContactList"
listId="{!listId}" rendered="{!listId != null}" />
<apex:outputText rendered="{!listId == null}" value="Could not find requewed ListView: '{!listName}'. Please contact your administrator."/>
</apex:component>
@jeffdonthemic
jeffdonthemic / BlogRequireJSDinamic.app
Last active August 29, 2015 14:11
Topcoder Blog Gists
<aura:application>
<aura:handler event="forcelogic2:BlogRequireJSEvent" action="{!c.initJS}"/>
<aura:registerEvent type="forcelogic2:BlogRequireJSEvent" name="requireJSEvent"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<div id="afterLoad">Old value</div>
</aura:application>