Skip to content

Instantly share code, notes, and snippets.


Vishnu Kumar TheVishnuKumar

View GitHub Profile
View ApexSpeedExperiment_3.cls
Speed Test - Which One is Fast to Compare String from ==, equals and equalsIgnoreCase
Author: 0to1Code.Com
public class ApexSpeedExperiment_3{
//Experiment 1 : Using ==
public static void runExperiment1(){
system.debug('CPU Limit Consumption Start: '+Limits.getCPUtime());
View BirthDayWishesController.cls
public class BirthDayWishesController {
//This method check for birthday with today's date. If condition get matched then it retues the true.
public static boolean wishTheBirthDay(){
User currentLoggedinUser = [Select id,Date_of_Birth__c from User Where Id =: UserInfo.getUserId() ];
if( currentLoggedinUser.Date_of_Birth__c != null ){
if( == currentLoggedinUser.Date_of_Birth__c.Day() && == currentLoggedinUser.Date_of_Birth__c.Month()){
return true;
View BirthDayWishes.cmp
<aura:component controller="BirthDayWishesController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<!--Including Css File-->
<ltng:require styles="{!$Resource.BirthDayWishes}"/>
<!--Boolean attribute-->
<aura:attribute name="showBalloons" type="boolean" default="false"/>
<!--Init handler to call the method on load of lightning component-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
View BirthDayWishesController.js
doInit : function(cmp, event, helper) {
var action = cmp.get("c.wishTheBirthDay");
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
cmp.set("v.showBalloons", response.getReturnValue());
else if (state === "ERROR") {
var errors = response.getError();
View BirthDayWishes.css
.container {
padding: 10px;
margin: 0 auto;
position: fixed;
.balloon {
width: 738px;
margin: 0 auto;
View Stopwatch.html
<div style="background: white;padding: 20px;border-radius: 6px;">
<div style="font-size: 20px;text-align:center;">{timeVal}</div>
<template if:true={showStartBtn}>
<lightning-button label="Start" onclick={start} style="margin-left: 145px;"></lightning-button>
<template if:false={showStartBtn}>
<lightning-button label="Stop" onclick={stop} style="margin-left: 145px;"></lightning-button>
View TomAndJerry.html
<template if:true={showTom}>
<img src=""/>
<template if:false={showTom}>
<img src=""/>
View Aura:if and Aura:set
<aura:renderIf isTrue="{!v.TrueVariable}">
<aura:set attribute="else">
View Rendered in VF
<apex:outputPanel rendered="{!TrueVariable}">
<apex:outputPanel rendered="{! !TrueVariable }">
View template if:true and template if:false
<!--This will render if isTrue = true-->
<template if:true={showTom}>
True Part
<!--This will render if isFalse = false-->
<template if:false={showTom}>
False Part