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 CSOMOperations(columnData,listName,action,itemID){ | |
| var context = SP.ClientContext.get_current(); | |
| var web = context.get_web(); | |
| var list = web.get_lists(); | |
| var targetList = list.getByTitle(listName); | |
| var item; | |
| switch(action){ | |
| case 'create': | |
| var listItemCreation = new SP.ListItemCreationInformation(); | |
| item = targetList.addItem(listItemCreation); |
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
| /*bootstrap 3 resets for SharePoint*/ | |
| /*border-box causes many issues with SP*/ | |
| *, *:before, *:after { | |
| -webkit-box-sizing: content-box; | |
| -moz-box-sizing: content-box; | |
| box-sizing: content-box; | |
| } | |
| /*reset elements that B3 is expecting to be border-box*/ | |
| * [class^="col-"], * [class^="col-"]:before, * [class^="col-"]:after, | |
| .container, .container:before, .container:after, |
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
| openssl x509 -inform PEM -in cacert.pem -outform DER -out certificate.cer |
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 toSum(numArray,sum){ | |
| let pairs = []; | |
| let hash = []; | |
| for(let i = 0;i < numArray.length; i++){ | |
| let counterPart = sum - numArray[i]; | |
| if(hash.indexOf(counterPart) != -1){ | |
| pairs.push([numArray[i],counterPart]); | |
| } | |
| hash.push(numArray[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 countUniqueString(arr){ | |
| const lookup = {}; | |
| for (let letter of arr) { | |
| // if letter exists, increment, otherwise set to 1 | |
| lookup[letter] ? lookup[letter] += 1 : lookup[letter] = 1; | |
| } | |
| return Object.keys(lookup); | |
| } | |
| countUniqueString('aabbbbbcccdefffff') |
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 search(array, val) { | |
| let min = 0; | |
| let max = array.length - 1; | |
| while (min <= max) { | |
| let middle = Math.floor((min + max) / 2); | |
| let currentElement = array[middle]; | |
| if (array[middle] < val) { |
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 countUniqueValues(arr){ | |
| if(arr.length === 0) return 0; | |
| var i = 0; | |
| for(var j = 1; j < arr.length; j++){ | |
| if(arr[i] !== arr[j]){ | |
| i++; | |
| arr[i] = arr[j] | |
| } | |
| } | |
| return i + 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 maxSubarraySum(arr, num){ | |
| let maxSum = 0; | |
| let tempSum = 0; | |
| if (arr.length < num) return null; | |
| for (let i = 0; i < num; i++) { | |
| maxSum += arr[i]; | |
| } | |
| tempSum = maxSum; | |
| for (let i = num; i < arr.length; i++) { | |
| tempSum = tempSum - arr[i - num] + arr[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 sumZero(arr){ | |
| let left = 0; | |
| let right = arr.length - 1; | |
| //Moving from left and right to middle | |
| while(left < right){ | |
| //First element + Last element | |
| let sum = arr[left] + arr [right]; | |
| if(sum === 0){ | |
| //Found a first matching pair | |
| return [arr[left], arr[right]]; |
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 validAnagram(first, second) { | |
| if (first.length !== second.length) { | |
| return false; | |
| } | |
| const lookup = {}; | |
| for (let letter of first) { | |
| // if letter exists, increment, otherwise set to 1 | |
| lookup[letter] ? lookup[letter] += 1 : lookup[letter] = 1; |
NewerOlder