Skip to content

Instantly share code, notes, and snippets.

View TheVishnuKumar's full-sized avatar
💭
http://www.0to1code.com/

Vishnu Kumar TheVishnuKumar

💭
http://www.0to1code.com/
View GitHub Profile
<template>
<template if:true={showTom}>
<img src="https://vignette.wikia.nocookie.net/tomandjerry/images/3/33/Tom_cat.png/revision/latest?cb=20111113021359"/>
</template>
<template if:false={showTom}>
<img src="http://pngimg.com/uploads/tom_and_jerry/tom_and_jerry_PNG56.png"/>
</template>
</template>
<template>
<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>
<template if:false={showStartBtn}>
<lightning-button label="Stop" onclick={stop} style="margin-left: 145px;"></lightning-button>
</template>
.container {
padding: 10px;
margin: 0 auto;
position: fixed;
}
.balloon {
width: 738px;
margin: 0 auto;
({
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();
<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}"/>
public class BirthDayWishesController {
//This method check for birthday with today's date. If condition get matched then it retues the true.
@AuraEnabled
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( Date.today().Day() == currentLoggedinUser.Date_of_Birth__c.Day() &&
Date.today().Month() == currentLoggedinUser.Date_of_Birth__c.Month()){
return true;
/*
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());
<div id="trailblazerWidget" trailblazerid="YOUR_TRAILBLAZER_ID">
<script src="https://rawgit.com/vishnuvaishnav/TrailheadWidget/master/Trailblazer.js" type="text/javascript"></script>
</div>
/*
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];
https://wa.me/{!Contact.Phone}?text={!JSENCODE("Hi "& Contact.Name &", We are from XYZ Corp. Want to connect with you regarding a new offering.")}