Skip to content

Instantly share code, notes, and snippets.

Avatar

Keir Bowden keirbowden

View GitHub Profile
@keirbowden
keirbowden / gist:6044762
Created Jul 20, 2013
Extension controller for a Publisher action that posts case information to an account feed.
View gist:6044762
public with sharing class ChatterAccountSnapshotExt
{
private Id accId;
public Boolean posted {get; set;}
public ChatterAccountSnapshotExt(ApexPages.StandardController std)
{
accId=std.getId();
posted=false;
}
@keirbowden
keirbowden / gist:6044766
Created Jul 20, 2013
Visualforce page for a Publisher action that posts case information to an account feed.
View gist:6044766
<apex:page standardcontroller="Account" extensions="ChatterAccountSnapshotExt">
<apex:form >
<apex:pageMessages />
<apex:pageBlock title="Service Snapshot">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Post to Feed" action="{!post}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Closed Cases" />
@keirbowden
keirbowden / gist:6204673
Created Aug 11, 2013
Visualforce/JQuery Mobile application to demonstrate swipe navigation
View gist:6204673
<apex:page docType="html-5.0" applyHtmlTag="false" controller="LaunchpadController" showHeader="false" sidebar="false" standardStyleSheets="false">
<head>
<title>Swipe Demo App</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"></meta>
<!-- JQuery Mobile -->
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"/>
<apex:styleSheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.3.1/jquery.mobile-1.3.1.min.js"/>
</head>
View gist:6687066
<apex:page standardController="Lead">
<style>
.fieldempty
{
background-color: yellow;
}
.fieldpopulated
{
background-color: white;
@keirbowden
keirbowden / gist:7292906
Created Nov 3, 2013
The Freezer - Visualforce page to allow users to be frozen or defrosted
View gist:7292906
<apex:page >
<script type="text/javascript">
var __sfdcSessionId = '{!GETSESSIONID()}';
</script>
<script src="../../soap/ajax/29.0/connection.js"
type="text/javascript"></script>
<script type="text/javascript">
function getUserInfo()
{
@keirbowden
keirbowden / Streaming.component
Last active Jul 23, 2017
Visualforce component to display browser notifications when a case is updated that is owned by the currently logged in user
View Streaming.component
<apex:component >
<apex:attribute name="topic" description="The topic name" type="String" required="true"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/jquery-1.5.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/json2.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/jquery.cometd.js')}"/>
<script type="text/javascript">
(function($){
$(document).ready(function() {
$.cometd.addListener("/meta/*",
@keirbowden
keirbowden / Streaming.page
Created Dec 27, 2013
Visualforce page that sets up the topic subscription and includes the streaming component to display browser notifications.
View Streaming.page
<apex:page controller="StreamingController">
<apex:pageMessages id="msgs" />
<apex:outputPanel id="all">
<apex:outputPanel rendered="{!topic==''}">
<apex:form >
<apex:actionFunction name="createTopic" action="{!CreateTopic}" rerender="all, msgs" />
<script>
alert('Creating topic - create topic function = ' + createTopic);
createTopic();
</script>
@keirbowden
keirbowden / StreamingController.cls
Created Dec 27, 2013
Custom controller for the streaming API browser notifications page.
View StreamingController.cls
public with sharing class StreamingController
{
public String getTopic()
{
String result='';
List<PushTopic> topics=[select id, Name from PushTopic where Name='Cases'];
if (0!=topics.size())
{
result='Cases';
@keirbowden
keirbowden / QRCode.page
Last active Nov 11, 2019
Salesforce1 QR Code Reader
View QRCode.page
<apex:page >
<script type="text/javascript"
src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/grid.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/version.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/detector.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/formatinf.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/errorlevel.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/bitmat.js')}"></script>
@keirbowden
keirbowden / BarcodeSF1
Created Mar 15, 2014
Visualforce page to decode a barcode from a captured or selected image.
View BarcodeSF1
<apex:page applyHtmlTag="false" showheader="false" sidebar="false" controller="BarcodeSF1Ctrl">
<head>
<title>BarcodeReader</title>
<apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.core.css')}"/>
<apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.default.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/lib/alertify.min.js')}"/>
</head>
<body>
<div>
<img width="320" height="240" src="" id="picture" style="border:10px groove silver" />
You can’t perform that action at this time.