Skip to content

Instantly share code, notes, and snippets.

View kiran-machhewar's full-sized avatar

Kiran Machhewar kiran-machhewar

View GitHub Profile
@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"/>
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;
@kiran-machhewar
kiran-machhewar / Logger.cls
Created October 20, 2013 17:02
Custom Logger
public with sharing class Logger {
public static List<LogInfo> logs {get;set;} //This will hold all the logs in each transaction
//Wrapper class to hold log content
//Used wrapper so as to leave space for further improvments
public class LogInfo{
private String logBody = '';
@kiran-machhewar
kiran-machhewar / LogPushTopic.cls
Created October 20, 2013 17:51
Log Push Topic
PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'Log';
pushTopic.Query = 'SELECT Id, Name, Log_Type__c From Log__c';
pushTopic.ApiVersion = 29.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;
@kiran-machhewar
kiran-machhewar / ConsoleController.cls
Created October 21, 2013 03:12
ConsoleController
public without sharing class ConsoleController{
public List<Log__c> logList {set;get;}
public ConsoleController(){
logList = new List<Log__c>();
}
public PageReference refreshLogs(){
String logId = ApexPages.currentPage().getParameters().get('logid');
@kiran-machhewar
kiran-machhewar / Console.page
Created October 21, 2013 03:09
Console.page
<apex:page controller="ConsoleController" sidebar="false" showHeader="false">
<apex:includeScript value="{!$Resource.cometd}"/>
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:includeScript value="{!$Resource.json2}"/>
<apex:includeScript value="{!$Resource.jquery_cometd}"/>
<style>
.AssertException{
background-color: yellow;
}
.Exception {
<apex:page sidebar="false" showHeader="false">
<script>
window.open('/apex/ChildPage','name','height=450,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
function reloadPage(url){
window.location=url;
}
</script>
</apex:page>
<apex:page >
<script>
if(confirm('Do you want to reload parent window by closing this child window?')){
top.window.opener.reloadPage('/home/home.jsp');
top.window.close();
}
</script>
</apex:page>
<apex:page standardController="<Your custom/standard object api name>">
<apex:detail subject="{!<Your custom/standard object api name>.Id}" relatedList="true" title="true"/>
</apex:page>
@kiran-machhewar
kiran-machhewar / Loading.component
Created December 31, 2013 04:30
Showing busy icon.
<apex:component >
<style>
body.wait, body.wait *{
cursor: wait !important;
}
</style>
<script>
//overriding the default send function of XMLHttpRequest
function addXMLRequestCallback() {