Skip to content

Instantly share code, notes, and snippets.


Vishnu Kumar TheVishnuKumar

View GitHub Profile
View TomAndJerry.html
<template if:true={showTom}>
<img src=""/>
<template if:false={showTom}>
<img src=""/>
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 BirthDayWishes.css
.container {
padding: 10px;
margin: 0 auto;
position: fixed;
.balloon {
width: 738px;
margin: 0 auto;
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.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.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 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 Trailhead Widget
<div id="trailblazerWidget" trailblazerid="YOUR_TRAILBLAZER_ID">
<script src="" type="text/javascript"></script>
View ApexSpeedExperiment_1.cls
Speed Test - Does System.Debug() cost CPU limit?
Author: 0to1Code.Com
public class ApexSpeedExperiment_1{
//Experiment 1 : Without Debugs
public static void runExperiment1(){
List<Lead> leadLst = [select id,name,company, Address, Industry, AnnualRevenue from lead limit 2000];
View WhatsApp Click to Chat in Salesforce{!Contact.Phone}?text={!JSENCODE("Hi "& Contact.Name &", We are from XYZ Corp. Want to connect with you regarding a new offering.")}