Skip to content

Instantly share code, notes, and snippets.

View metadaddy's full-sized avatar

Pat Patterson metadaddy

View GitHub Profile
@metadaddy
metadaddy / SiteLogin.page
Created February 26, 2013 21:00
OAuth for Portal Users
<apex:page showHeader="false" sidebar="false" standardStylesheets="false" cache="false" controller="SiteLoginController">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="format-detection" content="telephone=no" />
<title>
login
</title>
<apex:stylesheet value="{!$Resource.login}"/>
</head>
@metadaddy
metadaddy / ButtonController.cls
Last active December 14, 2015 08:59
Controlling physical devices from a Raspberry Pi and approvals in Force.com!
@RestResource(urlMapping='/button/*')
global class ButtonController {
@future(callout=true)
public static void light(Boolean state) {
HTTPRequest outreq = new HTTPRequest();
outreq.setEndpoint('http://api.superpat.com:5000/pins/25');
outreq.setMethod('POST');
outreq.setHeader('Content-Type', 'application/json');
outreq.setBody(state ? 'true' : 'false');
@metadaddy
metadaddy / user.json
Created May 22, 2013 17:24
Minimal example payload for user creation using Force.com REST API. Post this to https://instance.salesforce.com/services/data/v27.0/sobjects/User
{
"Username" : "user@example.com",
"Alias" : "user",
"Email" : "me@example.com",
"FirstName" : "Test",
"LastName" : "User",
"ProfileId" : "PROFILE_RECORD_ID",
"LanguageLocaleKey" : "en_US",
"LocaleSidKey" : "en_US",
"EmailEncodingKey" : "UTF-8",
@metadaddy
metadaddy / MobileInventory.page
Last active December 21, 2015 04:09
After adding price field.
<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Merchandise__c" extensions="MobileInventoryExtension"
recordSetVar="products">
<head>
<title>Mobile Inventory</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<apex:stylesheet value="{!URLFOR($Resource.jquerymobile130, 'jquery.mobile-1.3.0.min.css')}" />
@metadaddy
metadaddy / MobileInventory.page
Last active December 21, 2015 04:09
Mobile Workshop tutorial after adding logo
<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Merchandise__c" extensions="MobileInventoryExtension"
recordSetVar="products">
<head>
<title>Mobile Inventory</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<apex:stylesheet value="{!URLFOR($Resource.jquerymobile130, 'jquery.mobile-1.3.0.min.css')}" />
@metadaddy
metadaddy / MobileInventory.page
Last active December 21, 2015 04:09
After adding photo capture.
<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Merchandise__c" extensions="MobileInventoryExtension"
recordSetVar="products">
<head>
<title>Mobile Inventory</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<apex:stylesheet value="{!URLFOR($Resource.jquerymobile130, 'jquery.mobile-1.3.0.min.css')}" />
@metadaddy
metadaddy / MobileInventory.page
Last active December 21, 2015 04:09
After uploading photo
<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Merchandise__c" extensions="MobileInventoryExtension"
recordSetVar="products">
<head>
<title>Mobile Inventory</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<apex:stylesheet value="{!URLFOR($Resource.jquerymobile130, 'jquery.mobile-1.3.0.min.css')}" />
@metadaddy
metadaddy / MobileInventory.page
Last active December 21, 2015 04:09
After making Chatter File public
<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Merchandise__c" extensions="MobileInventoryExtension"
recordSetVar="products">
<head>
<title>Mobile Inventory</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<apex:stylesheet value="{!URLFOR($Resource.jquerymobile130, 'jquery.mobile-1.3.0.min.css')}" />
@metadaddy
metadaddy / MessageToTask.cls
Last active December 23, 2015 00:49
Visualforce TwiML page and Apex REST method for transcribing a voice message in Twilio and saving is as an Activity to a Lead.
@RestResource(urlMapping='/messagetotask')
global class MessageToTask {
@HttpPost
global static void incomingMessage() {
String expectedSignature =
RestContext.request.headers.get('X-Twilio-Signature');
String url = 'https://' + RestContext.request.headers.get('Host') +
'/services/apexrest' + RestContext.request.requestURI;
Map <String, String> params = RestContext.request.params;
@metadaddy
metadaddy / AnalyticsDemo.page
Last active December 24, 2015 01:29
Calling the Salesforce Winter '14 Analytics API from a Visualforce Page
<apex:page >
<style>
.chartHidden{
display: none;
}
.chartShown{
display: block;
}
</style>
<apex:includeScript value="{!$Resource.jquery}" />