This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Reference: https://developer.salesforce.com/docs/atlas.en-us.232.0.api_tooling.meta/api_tooling/tooling_api_objects_traceflag.htm | |
**/ | |
Map<String, Object> obj = new Map<String, Object>(); | |
obj.put('DebugLevelId', debugLevelId); | |
obj.put('StartDate', 'YYYY-MM-DDThh:mm:ss'); | |
obj.put('ExpirationDate', 'YYYY-MM-DDThh:mm:ss'); //Cannot be more than 24hrs from StartDate | |
obj.put('LogType', 'DEVELOPER_LOG'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A pangram is a sentence that contains every single letter of the alphabet at least once. Case is irrelevant. | |
// Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation. | |
function isPangram(string){ | |
let alph = 'abcdefghijklmnopqrstuvwxyz'; | |
for (let i = 0;i<alph.length;i++) { | |
if (string.toLowerCase(string).includes(alph.charAt(i)) == false) { | |
return false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ROT13 is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is an example of the Caesar cipher. | |
//Create a function that takes a string and returns the string ciphered with Rot13. If there are numbers or special characters included in the string, they should be returned as they are. Only letters from the latin/english alphabet should be shifted, like in the original Rot13 "implementation". | |
function rot13(message){ | |
let alph_lower = "abcdefghijklmnopqrstuvwxyz"; | |
let alph_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
let final = ""; | |
let position = 0; | |
let newposition = 0; | |
for (let i = 0; i<message.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get the middle Character of a given string, if the number characters is even return the two middle characters | |
function getMiddle(s) | |
{ | |
let size = (s.length%2==0) ? 'even' : 'odd'; | |
if (size=='even') { | |
let middle = (s.length/2)-1; | |
return s.substring(middle, middle+2); | |
} else { | |
let middle = (s.length-1)/2; | |
return s.substring(middle,middle+1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Beginner Series #3 Sum of Numbers (7kyu) | |
//Given two integers positive or negative, find the sum of all numbers in between, including them. If they are the same, return a or b. | |
function getSum( a,b ) | |
{ | |
let lower = a<b ? a : b; | |
let higher = a>b ? a : b; | |
let sum = 0; | |
for (let i = 0;i<(higher-lower+1);i++) { | |
sum += lower + i; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validatePIN (pin) { | |
let chars = pin.split(""); | |
let valid = ["0","1","2","3","4","5","6","7","8","9"]; | |
if (chars.length !== 4 && chars.length !== 6) { | |
return false; | |
} else { | |
for (let c of chars) { | |
if (!valid.includes(c)) { | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCount(str) { | |
let vowelsCount = 0; | |
let vowels = ['a','e','i','o','u']; | |
let chars = str.split(""); | |
for (let c of chars) { | |
if(vowels.includes(c)){ | |
vowelsCount += 1; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tickets(peopleInLine){ | |
let result = []; | |
let bill25 = 0; | |
let bill50 = 0; | |
let bill100 = 0; | |
for (let i=0;i<peopleInLine.length;i++) { | |
switch(peopleInLine[i]) { | |
case 25: | |
bill25 += 1; | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isIsogram(str){ | |
let upper = str.toUpperCase(); | |
if (upper == "") { | |
return true; | |
} | |
for (let c = 0; c < upper.length; c++){ | |
let counter = 0; | |
let char = upper[c]; | |
for (let i = 0; i < upper.length; i++){ |