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 chessBoard(sizeOfBoard){ | |
| const board = sizeOfBoard; | |
| for(let i=0;i<board;i++){ | |
| let evenPrintout = '#'; | |
| let oddPrintOut = ' #'; | |
| if(i === 0){ | |
| oddPrintOut = oddPrintOut; | |
| } | |
| if(i % 2 != 0){ |
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 getIndexToIns(arr, num) { | |
| let arrCopy = arr.sort(function(a, b){return a-b}); | |
| let lastIndexOfLowerNum = 0; | |
| for(let i=0;i<arrCopy.length;i++){ | |
| if(num>arrCopy[i]){ | |
| lastIndexOfLowerNum = i + 1; | |
| } | |
| if(num === arrCopy[i]){ | |
| lastIndexOfLowerNum = 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 titleCase(str) { | |
| //split to array of words | |
| let wordArr = str.split(' '); | |
| let newArr = []; | |
| wordArr.forEach(function(e){ | |
| e = e.toLowerCase(); | |
| e = e.replace(e[0], e[0].toUpperCase()); | |
| newArr.push(e); | |
| }) |
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
| arrayName[arryName.length - 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 isNum(arg){ | |
| if(arg <= 9 && arg >= 1){ | |
| return true; | |
| } else { | |
| 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
| // return masked string where only last 4 digits are shown | |
| function maskify(cc) { | |
| if (cc.length>4){ | |
| var masked = ''; | |
| for(i=0;i<cc.length-4;i++){ | |
| masked += cc[i].replace(cc[i], '#'); | |
| } | |
| masked += cc.substring(cc.length-4, cc.length); | |
| return masked; | |
| } else { |
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
| @isTest | |
| private class SOQLExamples { | |
| //Return Contact (name, email) with (Account (name, type) with (Owner (name, Profile)). Limit of 1 | |
| @isTest | |
| private static void num1() { | |
| Profile p = [SELECT Id, Name FROM Profile WHERE Name='Standard User']; | |
| User userObject = new User(Alias='SysAdmin', | |
| ProfileId=p.Id, | |
| Username='Johnadlkjdsfjwnelfk@john.com', | |
| LastName='Hutchins', |
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
| public with sharing class MapExercises { | |
| // Given a list of Accounts, create and return a map where the KEY is the Account Id and the values are the Account | |
| public static Map<Id, Account> getAccountMap(Account[] accs){ | |
| Map<Id, Account> accounts = new Map<Id, Account>(); | |
| for (Account ac : accs){ | |
| accounts.put(ac.Id, ac); | |
| } | |
| //System.debug('Get Account map from passed in data accounts === ', accs); | |
| return accounts; | |
| } |
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
| InputCleaner = function() { | |
| var start; | |
| start = function() { | |
| var onKeyUp; | |
| onKeyUp = function () { | |
| var text = $(this).val(); | |
| if (text.indexOf("<") !== -1 || text.indexOf(">") !== -1 || text.indexOf('"') !== -1 || text.indexOf("'") !== -1) { | |
| text = text.replace(/</g, ""); |
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
| export CLICOLOR=1 | |
| RED="\[\033[0;31m\]" | |
| BLACK="\[\033[0;37m\]" | |
| PS1="$\u \e[34;1m\]\w \n $ -—> " | |
| #PS1=“\e[47m\u@\h \w \e[m ” |