Skip to content

Instantly share code, notes, and snippets.

View jottley's full-sized avatar

Jared Ottley jottley

View GitHub Profile
@jottley
jottley / gist:31ba49d8429aaeef7219902957be49ec
Created July 16, 2016 05:28
Start XMPP Client investigation for alfresco-rumors
public void init()
{
final JobDetail jobDetail = new JobDetail(“StartXMPPClientsJob”, Scheduler.DEFAULT_GROUP, StartClientsJob.class);
jobDetail.getJobDataMap().put(“StartXMPPClients”, this);
long startTime = System.currentTimeMillis() + 60000L;
SimpleTrigger trigger = new SimpleTrigger(“StartXMPPClientsTrigger”, null, new Date(startTime), null, 0, 0L);
try
{
scheduler.scheduleJob(jobDetail, trigger);
}
@jottley
jottley / SFDC Picklist contains
Created July 16, 2016 04:52
Example: Check to see if a Salesforce picklist contains a value
Schema.DescribeFieldResult fieldResult = Contact.title.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
public Boolean contains(String title)
{
for (Schema.PicklistEntry t : ple)
{
if (t.getValue().equals(title))
{
return true;
@jottley
jottley / gist:108ff32cf377b28972f8
Created July 30, 2015 00:37
CMIS Browser Binding Raw HTTP File Upload
POST /ottleys.net/public/cmis/versions/1.1/browser/root/sites/jared-ottleys-net/documentlibrary/ HTTP/1.1
Authorization: Bearer <The OAuth Token>
Content-Type: multipart/form-data; boundary=__X_PAW_BOUNDARY__
Host: api.alfresco.com
Connection: close
User-Agent: Paw/2.2.2 (Macintosh; OS X/10.10.4) GCDHTTPRequest
Content-Length: 1358
--__X_PAW_BOUNDARY__
Content-Disposition: form-data; name="cmisaction"
@jottley
jottley / documentTypes.ftl
Created May 20, 2014 19:33
From Control: Example of reading property from a custom web script call to be displayed in a dynamically built drop down in edit mode.
<div class="form-field">
<#if form.mode=="view">
<div class="viewmode-field">
<span class="viewmode-label">${field.label?html}:</span>
<span class="viewmode-value">${field.value?html}</span>
</div>
<#else>
<script type="text/javascript">
//<![CDATA[
/* https://gist.github.com/jottley/aa482585bd1fb701492b */
@jottley
jottley / addoption.js
Last active September 29, 2017 09:08 — forked from juandopazo/addoption.js
function createElement(tag) {
return document.createElement(tag);
}
var addOption = function (combo, text, value, selected) {
/* Note by jdopazo:
Lazy initialization for the function _add()
I create a <select> element that I never attach to the dom
and try to attach an <'option'> element to it with try...catch
This way I avoid using try...catch every time this function is called */