Skip to content

Instantly share code, notes, and snippets.

@soe
soe / gist:8c17e633e2e14b2a2ca7acb81e867101
Created September 8, 2022 18:45
binarySearch pseudocode recursion method
binarySearch(array, target, startIndex, endIndex)
// target might still be in the range
if(endIndex >= startIndex)
midIndex = (startIndex + endIndex) // 2
// found!
if(target == array[midIndex])
return midIndex
@soe
soe / livechat.html
Created January 30, 2013 00:32
sample page on how to include Salesforce Live Agent button code and deployment code
<html>
<body>
<!-- live chat button -->
<a id="liveagent_button_online_573i00000004DD7" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('573i00000004DD7')">
Online Chat
</a>
<div id="liveagent_button_offline_573i00000004DD7" style="display: none;">
Offline Chat
</div>
// this example request for metadata retrieve and then post to the heroku service
MetadataService.MetadataPort service = MetadataValidator.createService();
MetadataService.RetrieveRequest retrieveRequest = new MetadataService.RetrieveRequest();
retrieveRequest.apiVersion = 27;
retrieveRequest.packageNames = null;
retrieveRequest.singlePackage = true;
retrieveRequest.specificFiles = null;
retrieveRequest.unpackaged = new MetadataService.Package_x();
<apex:page sidebar="false" showHeader="false" standardStylesheets="false">
<script type="text/javascript">
window.location = "{!URLFOR($Resource.mobileapp, 'index.html')}#sessionId={!$API.session_Id}";
</script>
</apex:page>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Salesforce.com Enterprise Web Services API Version 26.0
Generated on 2013-01-24 19:48:08 +0000.
Copyright 1999-2013 salesforce.com, inc.
All Rights Reserved
@soe
soe / sfdc-partner.wsdl
Last active December 11, 2015 14:29
sfdc-partner.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<!--
Salesforce.com Partner Web Services API Version 26.0
Generated on 2013-01-23 22:06:12 +0000.
Copyright 1999-2013 salesforce.com, inc.
All Rights Reserved
-->
@soe
soe / Challenge 2026
Last active December 11, 2015 12:18
Challenge 2026
2 files (routes/index.js and libs/cloudspokes.js) are changed in refactoring updateMember function.
"updateMember" function is modified to accept 1 more param: memberTabs which is retrieved from DocuSign API.
Please refer to change log here: https://github.com/soe/Docusign-Embedded-Signing/compare/cs2026
In the following gist (https://gist.github.com/4599566#file-tabs-json-output), "tabs" returned in JSON output from DocuSign API response is included for reference.
** Demo: http://docusign-soe.herokuapp.com/sign/a0IZ0000000FyJU/jeffdonthemic/99097A71-5EE0-43DD-A16F-6D0066983910/jdouglas@appirio.com
** Screencast: https://vimeo.com/57982065
@soe
soe / tabs JSON output
Created January 22, 2013 22:47
tabs JSON output
"tabs": {
"checkboxTabs": [{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "139",
"yPosition": "141",
"name": "Individual",
"requireInitialOnSharedChange": "false",
"selected": "true",
@soe
soe / gist:4005311
Created November 3, 2012 00:53
form.inc old
<?php
// $Id$
/**
* @defgroup forms Form builder functions
* @{
* Functions that build an abstract representation of a HTML form.
*
* All modules should declare their form builder functions to be in this
* group and each builder function should reference its validate and submit
@soe
soe / gist:4005307
Created November 3, 2012 00:52
form.inc new
<?php
/**
* @file
* Functions for form and batch generation and processing.
*/
/**
* @defgroup forms Form builder functions
* @{
* Functions that build an abstract representation of a HTML form.