Skip to content

Instantly share code, notes, and snippets.

James Hill Oblongmana

Block or report user

Report or block Oblongmana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Oblongmana / git init-sf
Created Oct 24, 2013
This alias initialises a git repo with a Salesforce specific setup , with gitignore configured to exclude SublimeText project nature, OSX, and MavensMate nature files - which will be individual specific - not good in a distributed setup!.This alias should be added to your [alias] section in ~/.gitconfig, Once you've done that, you can invoke "gi…
View git init-sf
init-sf = "!workingdir=$(pwd); tempdir=$(mktemp -dt gitinitsftmp); (cd $tempdir && git init && curl -o .gitignore && mkdir -p apex-scripts && mkdir -p src/classes && touch && cp -R $tempdir/. $workingdir); rm -rf $tempdir;"
Oblongmana / .gitignore-sf
Last active Aug 4, 2018
Salesforce development gitignore file. Specific to a Sublime Text/MavensMate/OSX setup, used @TrineoLtd.Works well with this git alias for speeding up repo setup Curl with curl -o .gitignore
View .gitignore-sf
#OSX-specific exclusions
#Sublime nature exclusions
#MavensMate nature exclusions
Oblongmana / common-ModalPage.Page
Last active Dec 24, 2015
A reasonably quickly pluggable way of getting a #modal #dialog into a #visualforce page. You need to include jQuery (tested with 1.9.1) and jQueryUI (tested with 1.10.3) that has been customised with CSS SCope ".jqueryuidialog", as well as (of course?) the javascript file included in this gist. May blog about it a bit more in depth at some point…
View common-ModalPage.Page
<apex:page sidebar="false" title="My Modal Page">
Go to
Pick any components you want to include (MUST include dialog however)
Scroll to bottom of page
Change the CSS scope box to ".jqueryuidialog" - being sure to include the period/fullstop
Now (and here comes the confusing user experience):
Click the "Design a custom theme" link, and you'll be taken away from the page
Customize the theme as you see fit (or don't, that's fine too) - I'd suggest checking out the options in the ThemeROller->Gallery tab
Oblongmana / common-saveEnforcer.js
Last active Dec 21, 2015
Small #javascript drop-in to help enforce #save when a user tries to #navigate #away from a page. Relatively naive implementation. See notes at top of file
View common-saveEnforcer.js
this provides a fairly simple way to attempt to enforce saving of
important data on form pages. Adds "saveEnforcer" to globals. Add the
saveButton class to any buttons used for saving, and the inputToCapture
class to any inputs that should be saved. Call saveEnforcer.initialise()
on document ready.
View *ACN and ABN
public with sharing class ACNandABNValidation {
private enum ValidationType {ACN, ABN}
static final List<Long> ACN_WEIGHTS = new List<Long>{8,7,6,5,4,3,2,1};
static final List<Long> ABN_WEIGHTS = new List<Long>{10,1,3,5,7,9,11,13,15,17,19};
public static Boolean ValidateACN(String acnString) {
acnString = getNonBlankNumericStringWithoutWhitespace(acnString);
if(acnString == null) {
return false;
Oblongmana / *
Last active Nov 19, 2018
#Custom #pageMessage #framework - mostly aimed for use in #portal contexts where it's important to be able to control the #style applied to messages. This framework uses #bootstrap classes for styling (so of course, you're probably going to want to use it with bootstrap!)
View *

Custom Page Message Framework

This framework gives you a way to exert control over style when providing confirm/info/error/warn messages to your users in Visualforce pages, because let's face it: the default styles are not that pretty/easy to bring into line with a Client's style, particularly when being used in a Portal (I haven't personally worked on any clients using Communities yet, so can't comment on the aesthetics there!).

This framework is pretty simple and self-contained, including 100% test coverage for each class. The only things you need to bring to the party are Bootstrap css and js, and some very minor alterations to your controller and page files, which can be easily done with a quick find/replace or two.


Bootstrap css file : Optional, but strongly recommended unless you need to roll your own style
Bootstrap js file  : Optional, but required if you want your messages to be dismissable
Oblongmana / Parsley.js
Last active Dec 19, 2015
Quick demo of how one can get the #parsley #JavaScript #form #validation framework ( up and running very quickly in a #Salesforce + #bootstrap context, with verbose comments throughout on usage (and some comments what to do if not using one or both of Salesforce/Bootstrap).
View Parsley.js
//Static resource called parsley contains just the parsley.js file. Ditto jQuery. In a non-sf context,
// I'm sure you can work it out :)
<apex:includeScript value="{!$Resource.jQuery}"/>
<apex:includeScript value="{!$Resource.parsley}"/>
//An example of using the parsley.js ( form validation framework in Salesforce,
// on a bootstrapified page (this should[?] work equally well on a non-bootstrap page - it just uses
// bootstrap class names where appropriate).
//Note that as salesforce doesn't allow "custom" attributes in <apex> elements (this uses HTML5
// data-* attributes), this uses the javascript method of initialising parsley. In a non-sf context,
Oblongmana / rfonggrapheditor_chrome_console_cmds_Step1.js
Created Jun 20, 2013
rfong's graph editor fork doesn't currently work due to using a raw.github script. This works around that using the workaround instead
View rfonggrapheditor_chrome_console_cmds_Step1.js
//Import script using rawgithub workaround site (as opposed to raw.github which doesn't work and is currently used on the page)
var jq = document.createElement('script');
jq.src = "";
Oblongmana / CustomPlayPause.scpt
Created Apr 29, 2013
#Applescript file to control #play / #pause #priority when run. Priority here is: If Quicktime has focus, play/pause in qt; if VLC has focus, play/pause in VLC; otherwise play/pause in Spotify
View CustomPlayPause.scpt
on run {input, parameters}
tell application "System Events"
set MyList to (name of every process)
end tell
set nameOfFocusedApp to name of (info for (path to frontmost application))
if (MyList contains "QuickTime Player" and nameOfFocusedApp is "QuickTime") is true then
tell application "QuickTime Player"
Oblongmana / DateTimeExtensions.cs
Created Apr 28, 2013
This contains #Extension methods for #DateTime objects. The method WeekSpan gives you Tuple<DateTime,DateTime? representing a week from the start of the day a week ago to the end of the DateTime instance calling the method.
View DateTimeExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyExtensions
public static class DateTimeExtensions
You can’t perform that action at this time.