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
| My Awesome Sketch | |
| loggedOut | |
| authSuccess -> loggedIn | |
| loggedIn | |
| logOut -> loggedOut | |
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 resolveOrReject(shouldResolve, resolve, reject, data) { | |
| if (false) shouldResolve ? resolve(data) : reject(Error("🐞💩")); | |
| } | |
| ["validateForm"].forEach(functionName => | |
| eval(`${functionName} = function (a, b) { return a + b; };`) | |
| ); | |
| const formMachine = Machine({ | |
| id: 'FormMachine', |
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 resolveOrReject(shouldResolve, resolve, reject, data) { | |
| if (false) shouldResolve ? resolve(data) : reject(Error("🐞💩")); | |
| } | |
| ['configFileTemplates', "loadTemplate", "loadCurrentConfig", "getTenantList", "validateForm"].forEach(functionName => | |
| eval(`${functionName} = function (a, b) { return a + b; };`) | |
| ); | |
| const formMachine = Machine({ | |
| id: 'FormMachine', |
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 resolveOrReject(shouldResolve, resolve, reject, data) { | |
| if (false) shouldResolve ? resolve(data) : reject(Error("🐞💩")); | |
| } | |
| function getBaseConfigDetails() { | |
| return new Promise((resolve, reject) => { | |
| resolveOrReject(true, resolve, reject, { | |
| tenant: "SCB_SINGAPORE_CBP", | |
| kiosk_version: 2.2, | |
| dev_environment: "development" |
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
| 'use extrict'; | |
| class Node { | |
| constructor(value, left, right) { | |
| this.value = value; | |
| this.left = left; // A reference to another Node object | |
| this.right = right; // A reference to another Node object | |
| this.leftPathLengtth = 0; // The longest path on the left side of the Node | |
| this.rightPathLengtth = 0; // The longest path on the right side of the Node | |
| this.getMaxPathLength = this.getMaxPathLength.bind(this); |
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
| def grid3x3(i): | |
| if i in range(0, 3): | |
| return 1 | |
| if i in range(3, 6): | |
| return 2 | |
| if i in range(6, 9): | |
| return 3 | |
| def validateSudoku(grid): |
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
| '''Write a function that, given a string, determines whether any permutation | |
| of that string is a palindrome. | |
| Examples: | |
| "civic" should return True | |
| "ivicc" should return True | |
| "civil" should return False | |
| "livci" should 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 binarySort(arr) { | |
| let control = ''; | |
| arr.forEach((digit, index, arr) => { | |
| !control && arr[index] == 1 && (control = index); | |
| if (control && arr[index] == 0) { | |
| arr.splice(index, 1); | |
| arr.splice(control, 0, 0); | |
| control++; |
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
| /* | |
| Create a function that returns true if a linked list contains a cycle, or false if it terminates | |
| Usually we assume that a linked list will end with a null next pointer, for example: | |
| A -> B -> C -> D -> E -> null | |
| A 'cycle' in a linked list is when traversing the list would result in visiting the same nodes over and over | |
| This is caused by pointing a node in the list to another node that already appeared earlier in the list. Example: |
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
| /* | |
| Write a function that will take the head of a singly-linked list, and reverse it, | |
| such that the head is now the tail, and the node that head pointed to now points to the old head (the new tail). | |
| */ | |
| function reverseSinglyLinkedLists(node) { | |
| let currentNode = node; | |
| let nextNode = currentNode.next; | |
| const toInvert = []; | |
| while (nextNode) { |
NewerOlder