Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<title></title>
</head>
<body>
<select style="max-width: 400px">
<option value="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
@pfeilbr
pfeilbr / veeva.js
Created March 18, 2013 16:47
Veeva API helper library
// Veeva API helper library
// dependencies: async
// Brian Pfeil - 2012-03-01 - init
(function() {
window.veeva = {
getRandomFunctionName: function() {
var randomNumber = Math.floor(Math.random() * (new Date()).getTime());
var millisecondsSinceEpoch = (new Date().getTime());
@pfeilbr
pfeilbr / gist:3686866
Created September 9, 2012 19:58
Download PDF from Trigger
global class PDFDownloader {
// called from trigger
@future (callout=true)
public static void download(String sessionID, String attId) {
String vfEndpoint = 'https://c.cs10.visual.force.com/apex/PDFTest_mrk?id=' + EncodingUtil.urlEncode(attId, 'UTF-8');
String vfSessionURL = 'https://cs10.salesforce.com/visualforce/session?url=' + EncodingUtil.urlEncode(vfEndpoint, 'UTF-8');
Http http = new Http();
@pfeilbr
pfeilbr / loadInlineTemplates.js
Created August 18, 2012 03:28
Load templates (mustache, jQuery, etc.) that are inlined in HTML to object
function loadInlineTemplates(templateSelector) {
var templatesString = $.trim($(templateSelector).html());
var templateName = null;
var templates = {};
$.each(templatesString.split("\n"), function(i, line) {
var matches = line.match(/(.*)\.mustache\:/i);
console.log(matches);
if (matches !== null) {
@pfeilbr
pfeilbr / reloadPageIfScriptChanges.js
Created August 18, 2012 03:24
Reload Page if [Java]Script Changes
// NOTE: depends on jQuery and hex_md5 function @ http://pajhome.org.uk/crypt/md5/
function reloadPageIfScriptChanges(patterns, pollInterval) {
patterns = $.isArray(patterns) ? patterns : [patterns];
$.ajaxSetup({ cache: false });
var digests = {};
setInterval(function() {
$('script[src]').each(function() {
var src = $(this).attr('src');
@pfeilbr
pfeilbr / example.js
Created February 12, 2012 19:57
Patch to forcetk.js to login & apexrest methods. add login via username & password with a grant_type of password to eliminate the Oauth redirect process
var c = new forcetk.Client('<client_id>');
c.login({
'environment': 'test',
'client_id': '<client_id>',
'client_secret': '<client_secret>',
'username': '[email protected]',
'password': 'secret123'
}, function(data) {
@pfeilbr
pfeilbr / dynamic-web-font-sizes.html
Created September 28, 2011 17:56
Dynamic Web Font Sizes
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Brian Pfeil">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
@pfeilbr
pfeilbr / horizontally & vertically center div in containing div
Created May 21, 2010 02:10
horizontally & vertically center div in containing div
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Brian Pfeil">
<!-- Date: 2010-05-20 -->
@pfeilbr
pfeilbr / Adobe AIR HTML Control <-> JavaScript Communication Example
Created March 20, 2010 10:06
Adobe AIR HTML Control <-> JavaScript Communication Example
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
<mx:HTML left="10" top="10" bottom="10" right="10" id="html"/>
<mx:Script>
<![CDATA[
private function init():void {
html.addEventListener(Event.COMPLETE, this.htmlComplete);
html.htmlText = Helper.html();
}
@pfeilbr
pfeilbr / register_ruby_example_service.rb
Created March 19, 2010 12:01
ruby windows service example
require "rubygems"
require "win32/service"
require "pp"
include Win32
options = {:service_name=>'ruby_example_service',
:service_type => Service::WIN32_OWN_PROCESS,
:description => 'A custom service I wrote just for fun',
:start_type => Service::AUTO_START,