Skip to content

Instantly share code, notes, and snippets.

View luciodevjob's full-sized avatar

Lucio Arcanjo Ferrari Junior luciodevjob

  • Alameda francisco de Miranda 244, duque de caxias , RJ
View GitHub Profile
<template>
<lightning-card title="Criar um novo lead">
<div class="slds-p-horizontal_small">
<lightning-record-edit-form object-api-name="Lead" onsuccess={handleSuccess} >
<lightning-messages> </lightning-messages>
<lightning-input-field field-name="Name">
</lightning-input-field>
<lightning-input-field field-name="Rating">
</lightning-input-field>
<lightning-input-field field-name="Company">
@luciodevjob
luciodevjob / html
Created August 4, 2022 21:21
medida
({
result : function(component, event, helper) {
var num1 = component.get("v.numero1");
var opp = component.get("v.temp");
if(opp == 'cf'){
var soma = (num1 * 9/5) + 32;
}else if(opp == 'ck'){
var soma = num1 + 273.15;
}else if(opp == 'fc'){
@luciodevjob
luciodevjob / html
Created August 4, 2022 21:19
Calculadora Aura
({
resultBotao : function(component, event, helper) {
var num1 = component.get("v.numero1");
var num2 = component.get("v.numero2");
var opp = component.get("v.operacao");
if(opp == '+'){
var soma = num1 + num2;
}else if(opp == '-'){
trigger AccountTrigger on Account (before insert, before update, after insert) {
//Inserir Prospect como padrão se o campo Type estiver em branco.
//before
if(Trigger.isBefore){
for(Account account: trigger.new){
if(String.isblank(account.Type) && Trigger.isInsert){
account.Type='Prospect';
//For acessa a nova trigger, passa para o if e valida se o campo TIPO está preenchido.
//IsBefore = ANTES e isInsert =Ação Durante a inserção
trigger RestrictContactByName on Contact (before insert) {
//verificar contatos antes de inserir ou atualizar para dados inválidos
For (Contact c : Trigger.New) {
if(c.LastName == 'INVALIDNAME') { //invalidname is invalid
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
}
}
}
@isTest
public class TestVerifyDate {
@isTest static void TestVerify(){
date dateTest = VerifyDate.CheckDates(date.parse('10/11/2022'), date.parse('22/04/2021'));
system.assertEquals(date.parse('30/11/2022'), dateTest);
}
@isTest static void TestVerify2(){
date dateTest = VerifyDate.CheckDates(date.parse('10/11/2022'), date.parse('22/12/2022'));
system.assertEquals(date.parse('30/11/2022'), dateTest);
}
public class Bicho {
public static void sortear(){
list<string> nomes = new list<string>{'Felipe', 'Pedro', 'Cristiam', 'gabriel' , 'Rodrigo', 'Luana','ygor'};
list<string> aposta = new list<string>{'pavao','galo', 'cachorro', 'gato', 'coelho', 'cobra','burro'};
list<integer> numeroSorteados = new list<integer>();
list<string> Bicho = new list<string>();
list<string> Grupo = new list<string>();
for(integer i=0; i < 5; i++){
numeroSorteados.add(integer.valueOf(math.random() * 99));
public class CalculadoraMagica {
public list<string> funcoes(integer a, integer b){
list<string> resultado = new list<string>();
integer soma = a + b;
resultado.add('Soma = ' + string.valueOf(soma));
integer subtracao = a - b;
resultado.add('Subtração = ' + string.valueOf(subtracao));
integer dividir = a / b;
resultado.add('Dividir = ' + string.valueOf(dividir));
@luciodevjob
luciodevjob / Calculadora
Last active June 28, 2022 20:11
calculadora
//Anonymous apex code
Calculadora fun = new Calculadora();
fun.somar( 10, '+', 20);
fun.somar( 20, '-', 10);
fun.somar( 20, '/', 10);
List<integer> MegaSena = new List<integer>();
for(integer i = 0; i <= 60; i++){
MegaSena.add(i);
}
system.debug('Os numeros sorteados são: ' +
MegaSena[integer.valueof(system.Math.random() * 6 )] + ' ' +
MegaSena[integer.valueof(system.Math.random() * 10 )] + ' ' +
MegaSena[integer.valueof(system.Math.random() * 20 )] + ' ' +