Skip to content

Instantly share code, notes, and snippets.

View kiran-machhewar's full-sized avatar

Kiran Machhewar kiran-machhewar

View GitHub Profile
public with sharing class CallOutUtil {
public String data {get;set;}
public CallOutUtil(){
data = getContent(ApexPages.currentPage().getParameters().get('url'));
//encoding data so as to avoid any data loss
data = EncodingUtil.base64Encode(Blob.valueOf(data));
}
Account acc = new Account(Name='My Account');
insert acc; //you can make dml before callout :)
System.debug(CallOutUtil.doCallout('https://www.google.co.in/search?q=heroku'));
delete acc;
function addXMLRequestCallback() {
var oldSend, oldonreadystatechange;
/*saving the orginal method*/
oldSend = XMLHttpRequest.prototype.send;
/*overrideing the default behaviour*/
XMLHttpRequest.prototype.send = function() {
/*calling the default behaviour*/
oldSend.apply(this, arguments);
oldonreadystatechange = this.onreadystatechange;
this.onreadystatechange = function ( progress ) {
<apex:component controller="PicklistController" >
<apex:attribute name="value" required="true" type="String" description="Provide the field binding"/>
<apex:attribute name="objectName" required="true" type="String" description="Provide object name"/>
<apex:attribute name="valueField" required="true" type="String" description="Provide the value field for the picklist"/>
<apex:attribute name="labelField" required="true" type="String" description="Provide the label field which needs to be shown in picklist"/>
<apex:attribute name="styleClass" required="false" type="String" description="Style class for the select list"/>
<apex:attribute name="required" required="false" type="Boolean" default="false" description="Id of picklist component"/>
<apex:attribute name="style" required="false" type="Boolean" default="" description="Style for the select list"/>
<apex:attribute name="filterFields" required="false" type="String"
/**
* ApexClass : PicklistController
* Description : Controller to the piklist component.
*/
global class PicklistController{
public String uniqueId {get;set;} //Uniquie id so that every components javscript code should be separate
/**
* CONSTRUCTOR
<apex:page standardController="Opportunity">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"/>
<apex:form >
<apex:pageMessages id="pageMessages"/>
<apex:pageBlock title="Custom Picklist Demo">
<apex:pageBlockSection >
<apex:repeat value="{!$ObjectType.Opportunity.Fieldsets.PicklistDemoFields}" var="field">
<apex:inputField value="{!opportunity[field]}" rendered="{!$ObjectTYpe.Opportunity.fields[field].Type!='reference'}"/>
<apex:pageBlockSectionItem rendered="{!$ObjectTYpe.Opportunity.fields[field].Type=='reference'}" >
<apex:outputLabel value="{!$ObjectType.Opportunity.fields[field].Label}"/>
public class Notification{
/**
* @description :
* @param jobName Name of the scheduler
* @param durationInMinutes Greater duration than the time interval between scheduler executions.
*/
public static void addNotificationFor(String jobName, Integer durationInMinutes){
Notification__c notification = new Notification__c(
Name = jobName,
External_Code__c = jobName,
public class Notification{
/**
* @description :
* @param jobName Name of the scheduler
* @param durationInMinutes Greater duration than the time interval between scheduler executions.
*/
public static void addNotificationFor(String jobName, Integer durationInMinutes){
Notification__c notification = new Notification__c(
Name = jobName,
External_Code__c = jobName,
@kiran-machhewar
kiran-machhewar / SFCompare.page
Created February 14, 2015 14:11
Code Comparison Utility Page
<!--
This page has functionality to compare code from two different orgs.
Here following libraries are used.
Select2 : Gibhub: http://select2.github.io/
Mergely : An Awesome code comparison javascript library by jamie.peabody@gmail.com
Github: https://github.com/wickedest/Mergely
JQuery and Bootstrap
-->
<apex:page sidebar="false" controller="SFCompareController" showHeader="false" standardStylesheets="false">
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
@kiran-machhewar
kiran-machhewar / SFCompareController
Last active October 6, 2018 12:52
Controller for SFCompare.page
/**
* @ApexClass : SFCompareController
* @Description : This provides services to SFCompare page, which can be accessed by js remoting. It provides below services.
* 1. Logging into SF orgs for obtaining session and instance url.
* 2. Fetches code from the SF org.
* */
public class SFCompareController {
/**
* @description : This method does the login to sf orgs and provides session id and