Skip to content

Instantly share code, notes, and snippets.

public class JSONObject {
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@fractastical
fractastical / Chuck Tomanek convert 15 character ID Strings to 18 chars.txt
Created May 24, 2011 21:39
Chuck Tomanek convert 15 character ID Strings to 18 chars
// http://www.sundog.net/sunblog/posts/a-handy-method-for-converting-15-character-id-strings-in-salesforce-to-18-c/
public string generate18CharId(string id){
// This method will take a 15 character ID and return its 18 character ID:
if (id == null){
return null;
}
if (id.length() != 15) {
@fractastical
fractastical / boyd_r URL Navigation for Custom Objects.txt
Created May 24, 2011 21:38
boyd_r URL Navigation for Custom Objects
http://bit.ly/cj450K
//Get a reference to the Custom Object and gets its Key
Schema.DescribeSObjectResult result = customObject__c.sObjectType.getDescribe();
//navigate to the View Page
PageReference pageRef = New PageReference('/' + result.getKeyPrefix() + '/o');
pageRef.setRedirect(true);
return pageRef;
@fractastical
fractastical / Apex-Lang List Functions (Merge, etc.) .txt
Created May 24, 2011 21:38
Apex-Lang List Functions (Merge, etc.)
/* ============================================================
* This code is part of the "apex-lang" open source project avaiable at:
*
* http://code.google.com/p/apex-lang/
*
* This code is licensed under the Apache License, Version 2.0. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================
@fractastical
fractastical / @umityalcinalp URLRewriter.txt
Created May 24, 2011 21:38
@umityalcinalp URLRewriter
http://blog.sforce.com/sforce/2010/05/url-rewriting-for-your-customizing-your-site-urls.html
global class ApexClassName implements Site.UrlRewriter {
global PageReference mapRequestUrl(PageReference externalUrl) {//}
global List<PageReference> generateUrlFor(List<PageReference> myForcedotcomUrls) {//...}
}
<apex:page controller="popup">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="popup"/>
<apex:pageBlock >
Lorem ipsum ..... dummy stuff to show the popup is above content
</apex:pageBlock>
<apex:outputPanel id="popup">
<apex:outputPanel styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
Lorem ipsum <br/><br/><br/>
public class popup {
public boolean displayPopup {get; set;}
public void closePopup() {
displayPopup = false;
}
public void showPopup() {
displayPopup = true;
/*
[email protected]
creates entities required for testing.
*/
public with sharing class TestUtility {
/*
A random user is useful for testing in order to be
sure that you are able to see data across posts regardless
<apex:enhancedList type="Account" height="300" rowsPerPage="10" id="AccountList" />
<apex:dataTable value="{!accounts}" var="account" id="theTable">
<apex:facet name="caption">table caption</apex:facet>
<apex:facet name="header">table header</apex:facet>
<apex:facet name="footer">table footer</apex:facet>
<apex:column>
<apex:facet name="header">Name</apex:facet>
<apex:facet name="footer">column footer</apex:facet>
<apex:outputText value="{!account.name}"/>
</apex:column>
<apex:column>