Skip to content

Instantly share code, notes, and snippets.

View RatanPaul's full-sized avatar
💭
I may be slow to respond.

Ratan Paul (http://ratanpaul.github.io/) RatanPaul

💭
I may be slow to respond.
View GitHub Profile
@RatanPaul
RatanPaul / ScheduledDispatcher.cls
Created February 4, 2016 12:35 — forked from gbutt/ScheduledDispatcher.cls
apex scheduled dispatcher - this is how you can schedule code in SFDC without locking up all your classes
/***
This class can be used to schedule any scheduled job without risk of locking the class.
DO NOT CHANGE THIS CLASS! It is locked by the scheduler. Instead make changes to ScheduledHelper or your own IScheduleDispatched class
To use:
1) Create a new class to handle your job. This class should implement ScheduledDispatcher.IScheduleDispatched
2) Create a new instance of ScheduledDispatcher with the type of your new class.
3) Schedule the ScheduledDispatcher instead of directly scheduling your new class.
See ScheduledRenewalsHandler for a working example.
***/
global class ScheduledDispatcher implements Schedulable {
@RatanPaul
RatanPaul / BatchJob.cls
Created January 5, 2016 10:11 — forked from mjgallag/BatchJob.cls
Scheduled Batch Job Test Example
global class BatchJob implements Database.Batchable<Account> {
global Account[] start(Database.BatchableContext batchableContext) {return new Account[]{};}
global void execute(Database.BatchableContext batchableContext, Account[] accounts) {}
global void finish(Database.BatchableContext batchableContext) {}
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@RatanPaul
RatanPaul / gist:dba99dc31cee53a6c9cf
Created January 4, 2016 07:48 — forked from henriquez/gist:3146782
Example Javascript that uses ajax proxy to make request to Chatter API
<apex:page controller="CustomerCommunityController" id="customercommunitycontroller" sidebar="false" showHeader="false" standardStylesheets="false" >
<head>
<title>Acme Customer Support</title>
<meta charset="utf-8" />
<apex:includeScript value="{!$Resource.jquery}"/>
</head>
<script type="text/javascript">
@RatanPaul
RatanPaul / SimpleProxyClient.page
Created January 4, 2016 07:47 — forked from richardvanhook/SimpleProxyClient.page
Simple VF page that demonstrates how to hit REST API. NOTE: User must have access to Chatter REST API for this exact demo to work.
<apex:page docType="html-5.0" sidebar="false" showHeader="false"
standardStylesheets="false" cache="true">
<!-- TRANSFORM PARTNER URL INTO TRUE PROXY URL -->
<apex:variable var="PARTNER_URL" value="{!$Api.Partner_Server_URL_290}" />
<apex:variable var="PARTNER_URL_SPLIT" value="{!
LEFT(PARTNER_URL,FIND('.visual.force.com',PARTNER_URL)-1)
}"/>
<apex:variable var="POD" value="{!
MID(PARTNER_URL_SPLIT,FIND('.',PARTNER_URL_SPLIT)+1,LEN(PARTNER_URL_SPLIT))
<apex:page docType="html-5.0" sidebar="false" showHeader="false"
standardStylesheets="false" cache="true">
<html lang="en">
<head>
<meta charset="utf-8"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var SESSION_ID = '{!$Api.Session_ID}';
var serverURL = '{!SUBSTITUTE(SUBSTITUTE(LEFT($Api.Partner_Server_URL_210, FIND( '/services', $Api.Partner_Server_URL_260)), 'visual.force', 'salesforce'), 'c.', '')}';
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
@RatanPaul
RatanPaul / Cross Table Drag Drop.html
Created November 21, 2015 09:58 — forked from davemo/Cross Table Drag Drop.html
This works for dragging, dropping table rows between two separate tables across most browsers :)
<!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="David Mosher">
<!-- Date: 2010-11-18 -->
@RatanPaul
RatanPaul / dynamicPagRepeatAngular.html
Created October 23, 2015 17:15 — forked from kmaida/dynamicPagRepeatAngular.html
AngularJS - Dynamic pagination on ng-repeat with search/filtering. Use with ui.bootstrap
<!DOCTYPE HTML>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>Dynamic Pagination w/ Filtering</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Kim Maida">
<!-- JS Libraries -->