This file contains 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
# Kubenetes (Minikube / Kubecli) and related Linux / VIM commands | |
#Linux / Command line | |
~ = return the terminal ? | |
Ctrl+C = cancel | |
## VI |
This file contains 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 class AnimalLocator { | |
public static String getAnimalNameById(Integer i){ | |
Http http = new Http(); | |
HttpRequest request = new HttpRequest(); | |
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + i); | |
request.setMethod('GET'); | |
HttpResponse response = http.send(request); | |
This file contains 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 class ParkLocator { | |
public static List<String> country(String country){ | |
ParkService.ParksImplPort prkSvc = new ParkService.ParksImplPort(); | |
return prkSvc.byCountry(country); | |
} | |
} |
This file contains 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 | |
public class AnimalLocatorTest { | |
@isTest static void testGetAnimalNameById() { | |
Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock()); | |
String result = AnimalLocator.getAnimalNameById(1); | |
System.assertEquals('moose', result); | |
} | |
@isTest static void testGetAnimalNameById500() { |
This file contains 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
trigger RestrictContactByName on Contact (before insert, before update) { | |
//check contacts prior to insert or update for invalid data | |
For (Contact c : Trigger.New) { | |
if(c.LastName == 'INVALIDNAME') { //invalidname is invalid | |
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML'); | |
} | |
} | |
} |
This file contains 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 class ContactSearch { | |
public static List<Contact> searchForContacts(String lastName, String postCode){ | |
Contact[] cts = [SELECT ID, Name FROM Contact | |
WHERE LastName= :lastName AND MailingPostalCode= :postCode ]; | |
System.debug(cts); | |
This file contains 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 class AccountHandler { | |
public static Account insertNewAccount(String accName){ | |
if(accName == '') | |
{ | |
return null; | |
} | |
Account acct = new Account(Name=accName); |
This file contains 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 class StringArrayTest { | |
public static String[] generateStringArray(Integer numStrings){ | |
String[] stringArray = new List<String>(); | |
for (Integer i = 0, j = 0; i < numStrings; i++) { | |
System.debug('Test ' + i); | |
stringArray.Add('Test ' + i); | |
} |
This file contains 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
"use strict"; | |
// Classes. A bit of sugar over prototype based OO pattern | |
class StringCalc { | |
// COnstructor.. just an excuse to use one really | |
constructor(decimalPrecision, calcName) { | |
this.decimalPrecision = decimalPrecision; | |
this.calcName = calcName; | |
this.sumTotal = 0; |
This file contains 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
/* 1. Take the following string "Davis, Clyne, Fonte, Hooiveld, Shaw, Davis, Schneiderlin, Cork, Lallana, Rodriguez, Lambert" | |
and give each player a shirt number, starting from 1, to create a string of the form: "1. Davis, 2. Clyne, 3. Fonte" etc */ | |
var arrayPlayers = "Davis, Clyne, Fonte, Hooiveld, Shaw, Davis, Schneiderlin, Cork, Lallana, Rodriguez, Lambert".Split(','); | |
// Query Style | |
//var i = 1; | |
//var queryPlayers = from player in arrayPlayers | |
// select i++ + " " + player; |