Skip to content

Instantly share code, notes, and snippets.

View Sunil02kumar's full-sized avatar

Sunil Kumar Sunil02kumar

View GitHub Profile
<apex:page standardStylesheets="false" sidebar="false" showHeader="false" applyBodyTag="false" applyHtmlTag="false" docType="html-5.0" controller="smartTableAngularJSController">
<html lang="en" ng-app="demoApp">
<head>
<!-- <meta charset="utf-8"/>-->
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Angular Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.min.js"></script>
public class SOQLInjectionDemoController {
public String name {get;set;}
public String queryString{get;set;}
public List<Account> accList{get;set;}
public SOQLInjectionDemoController (){
accList = new List<Account>();
}
public PageReference query() {
if(name !=null && name !=''){
accList = new List<Account>();
//--------------------------------------------------------------
//Author- Sunil Kumar ([email protected])
//Date - 15 Jan, 2017
//Purpose - Controller for ComponentHierarchy to generate Data for record Hierarchy
//-----------------------------------------------------------
public class hierarchyComponentController {
public string recordid{get;set;}
public String objectAPIName{get;set;}
public String parentFieldAPIName{get;set;}
public class CollectionLimitController {
public List<Account> collectionSizeVariable{get;set;}
public String AccountInformationString {get;set;}
public CollectionLimitController(){
collectionSizeVariable = new List<Account>();
for(integer i=0;i<50007;i++){
collectionSizeVariable.add(new Account(name='sunil'+i, type='Prospect', Industry='IT'));
}
datasetForTable dataSet =new datasetForTable();
<apex:page controller="boxFilePickerDemoController">
<html>
<head>
<script type="text/javascript" src="https://app.box.com/js/static/select.js"></script>
</head>
<body>
<!--xxxxxx- Paste Client ID from Box edit application URL -->
<div id="box-select" data-link-type="shared" data-multiselect="true" data-client-id="xxxxxx"></div>
<script>
//Copy Client Id and replace xxxxxx from URL by clicking on edit application in box application
Public class FileDownLoadUtility{
public static blob fetchFileFromExternalUrl(String extFileUrl){
//extFileUrl='https://drive.google.com/file/d/0ByXILxflqQ2jWGpNVmI1WW9uYTQ/view?usp=sharing';
Http h = new Http();
HttpRequest req = new HttpRequest();
//Replace any spaces in extFileUrl with %20
extFileUrl = extFileUrl.replace(' ', '%20');
//Set the end point URL
req.setEndpoint(extFileUrl);
<aura:component >
<lightning:button label="Create Button" onclick="{!c.createButtonDynamically}" variant="brand"/>
<lightning:button label="Destroy All buttons" onclick="{!c.removeButtonDynamically}" variant="destructive"/>
<br/>
<div style="margin:auto; height:600px; width:400px; border:2px ridge red;" aura:id="newtag">
{!v.body}
</div>
</aura:component>
<aura:component >
<aura:attribute name="msgFromNotifier" type="String"/>
<!-- give same name as that of notifier registerEvent name attribute -->
<aura:handler name="newCarAccident" event="c:carAccident" action="{!c.handleNotification}"/>
<!-- Handler should contains notifier component-->
<c:carAccidentNotifier />
<div>message from Notifier : <b>{!v.msgFromNotifier}</b></div>
</aura:component>
public class RandomUtility {
//method to return random value between 2 numbers
public static Integer generateRandomFromRange(integer startNum, integer endNum){
Integer returnValue;
//Logic- first we will generate random boolean value which will decide if we want to
//add the random number from startNum or will subtract random number from endNum
Integer randomNumber = Integer.valueof((math.random() * 10));
boolean addSubFlag= math.mod(randomNumber,2) == 0 ? true : false;
public class CalloutUtility {
//method to retrieve information about the Salesforce version
public static HttpResponse performCallout() {
HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
String domainUrl=URL.getSalesforceBaseUrl().toExternalForm();
system.debug('********domainUrl:'+domainUrl);
req.setEndpoint(domainUrl+'/services/data/');
req.setMethod('GET');