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
### Keybase proof | |
I hereby claim: | |
* I am joecortopassi on github. | |
* I am joecortopassi (https://keybase.io/joecortopassi) on keybase. | |
* I have a public key whose fingerprint is 6471 612D D933 7DB0 CD7F 4F63 1441 56CD 4A7C BDAF | |
To claim this, I am signing this object: |
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
-----BEGIN PGP MESSAGE----- | |
Version: GnuPG/MacGPG2 v2.0.22 (Darwin) | |
Comment: GPGTools - https://gpgtools.org | |
hQEMAxtTNQ8zAtGEAQgApW8XCN8DETlgHlya8Q2z0AzdWo/rkLxYm1hsxUf6CADk | |
DlYfgn9FQ7nLfBa2Q7XDNTOdMfwCO1KHaFNP6tpaunBOPtLOVLfXPzVnAXqO//3a | |
4z8oVE6u2N3Sb9G77CUDK/fpqDqrs9uJgKOQ9kOvvGDMHuo/3G3JlNVUq9nwJKoc | |
WKJwBswvtulrRXAvWOheR6gMpkKXVLNC81c2+KVzvp4dZm/dYOfHfylla7qt+BCM | |
/eP17oDEFwqgm/x2RrFKTTDsZHINnQMfS8kaJyVnUM4/upr/jG8XrrNI7JOaOmBJ | |
wPd6PzjC89DHmSlZGYCs9RG41TPXVwbP5Iv+IRs2RNKFATnPFCvfMiqyHO3q7+82 |
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
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# Version 2.0 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# | |
# 2013 updates: | |
# - fixed the broken "save personal Schemes" | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, |
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
function isValidIP(str) { | |
return str | |
.split('.') | |
.filter(numPredicate) | |
.filter(rangePredicate) | |
.length === 4; | |
} | |
let numPredicate = num => (parseInt(num, 10) + '') === num; | |
let rangePredicate = num => parseInt(num, 10) >= 0 && parseInt(num, 10) <= 255; |
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
function pascalRow(row) { | |
let prev = []; | |
let curr = []; | |
for (let i = 1; i <= row; i++) { | |
prev = curr; | |
curr = []; | |
if (prev.length === 0) { | |
curr = [1]; | |
continue; | |
} |
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
class Node { | |
constructor (val) { | |
this.value = val; | |
this.left = null; | |
this.right = null; | |
} | |
add (val) { | |
if (val === this.value) return; |
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
function biggestPalindrome (str) { | |
if (str.length === 1) return str; | |
const pieces = str.split(''); | |
let longestPalindrome = ''; | |
for (let i = 1; i <= pieces.length; i++) { | |
let offset = 1; | |
do { | |
if (pieces[i-offset] === pieces[i+offset]) { | |
const newPalindrome = str.substring(i-offset, i+offset+1); | |
if (newPalindrome.length > longestPalindrome.length) longestPalindrome = newPalindrome; |
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
function quickSort(arr) { | |
if (arr.length <= 1) return arr; | |
const pivot = arr[Math.floor(arr.length/2)]; | |
const lower = arr.filter(val => val < pivot); | |
const equal = arr.filter(val => val === pivot); | |
const higher = arr.filter(val => val > pivot); | |
return [...quickSort(lower), ...quickSort(equal), ...quickSort(higher)]; | |
} |
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
function binarySearch (search, arr) { | |
let lower = 0; | |
let upper = arr.length; | |
while (lower < upper) { | |
let mid = lower + Math.floor((upper - lower) / 2); | |
if (arr[mid] === search) { | |
return mid; | |
} else if (arr[mid] < search) { |
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
function quickSort(arr) { | |
if (arr.length <= 1) return arr; | |
const pivot = arr[Math.floor(arr.length/2)]; | |
const lower = arr.filter(val => val < pivot); | |
const equal = arr.filter(val => val === pivot); | |
const higher = arr.filter(val => val > pivot); | |
return [...quickSort(lower), ...quickSort(equal), ...quickSort(higher)]; | |
} |
OlderNewer