Skip to content

Instantly share code, notes, and snippets.

Avatar

Keir Bowden keirbowden

View GitHub Profile
@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 / SigCapFlowWithFinishController.js
Created Oct 29, 2019
Aura component controller to handle flow navigation.
View SigCapFlowWithFinishController.js
({
handleCaptured : function(component, event, helper)
{
console.log('Captured signature')
let flowAction=null;
let availableActions=component.get('v.availableActions');
console.log('Available actions = ' + availableActions);
for (let idx=0; idx<availableActions.length && null==flowAction; idx++) {
let availAction=availableActions[idx];
if ('NEXT'==availAction) {
@keirbowden
keirbowden / SigCapFlowWithFinish.cmp
Created Oct 29, 2019
Aura component to handle flow navigation.
View SigCapFlowWithFinish.cmp
<aura:component implements="lightning:availableForFlowScreens">
<aura:attribute access="global" name="startMsg" type="String" default="Click the 'Capture Signature' button to begin"
description="Message to display to the user to start the signature capture process"/>
<aura:attribute access="global" name="enterMsg" type="String" default="Sign here please"
description="Text to display above the signature capture canvas" />
<aura:attribute access="global" name="completeMsg" type="String" default="Here is the captured signature"
description="Text to display above the image of the captured signature once it has been saved to the server"/>
<aura:attribute access="global" name="recordId" type="String"
description="The id of the record to attach the signature to"/>
<aura:attribute access="global" name="saveAttachment" type="Boolean" default="true"
@keirbowden
keirbowden / tasks.json
Last active Jul 13, 2019
VSCode task file to execute
View tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "node",
"args": [
"deploy.js"
],
"problemMatcher": [ {
@keirbowden
keirbowden / deploy.js
Created Jan 26, 2018
Simple node script to execute a deployment via SFDX and capture and output any errors that occurred
View deploy.js
#!/usr/local/bin/node
var fs=require('fs');
var child_process=require('child_process');
var username='keir.bowden@googlemail.com';
var deployParams=['force:mdapi:deploy', '-d', 'src',
'-u', username, '--json'];
@keirbowden
keirbowden / animatedBar.js-meta.xml
Created Apr 6, 2019
XML Metadata for the Animated Bar Lightning Web Component
View animatedBar.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="animatedBar">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
@keirbowden
keirbowden / animatedBar.js
Created Apr 6, 2019
JavaScript for the Animated Bar Lightning Web Component
View animatedBar.js
/* eslint-disable no-console */
import { LightningElement, track } from 'lwc';
export default class AnimatedBar extends LightningElement {
@track value = 0;
handleInputValueChanged(event) {
window.clearTimeout(this.delayTimeout);
const final = event.target.value;
@keirbowden
keirbowden / animatedBar.html
Created Apr 6, 2019
Animated Progress Bar Lightning Web Component Markup
View animatedBar.html
<template>
<div class="slds-m-around_small">
<div class="slds-text-heading_large slds-m-bottom_small">Progress Bar Demo</div>
<div class="slds-m-bottom_large">
<label>Enter value : <lightning-input type="number" name="seven" value="0" placeholder="Enter the amount..." onchange={handleInputValueChanged}></lightning-input></label>
</div>
<div>
<div style="width:25%" class="slds-progress-bar slds-progress-bar_circular slds-progress-bar_large"
aria-valuemin="0" aria-valuemax="100" aria-valuenow={amount} role="progressbar">
<span class="slds-progress-bar__value" style={width}>
@keirbowden
keirbowden / deploy_with_exit_codes.js
Created Apr 16, 2018
Node script to execute a deployment and return 0 for success or 1 for failure.
View deploy_with_exit_codes.js
#!/usr/local/bin/node
var fs=require('fs');
var child_process=require('child_process');
var username='keir.bowden@sfdx.deploy';
var deployParams=['force:mdapi:deploy', '-d', 'Orchestrate/src',
'-u', username, '--json'];
@keirbowden
keirbowden / AccountController.cls
Created Dec 12, 2015
Apex controller from the Lightning Component Wrapper Classes blog post
View AccountController.cls
public with sharing class AccountController
{
@AuraEnabled
public static List<Account> GetAccountNames()
{
return [select id, Name from Account limit 10];
}
@AuraEnabled
public static List<Account> GetAccountDetails(String idListJSONStr)
You can’t perform that action at this time.