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
const ValidActions = { | |
'blips': { | |
'hook': 'MATCH (n:BLIP)', | |
'action': (val) => { | |
return ValidActions.blips[val](); | |
}, | |
'published': () => { | |
return 'MATCH (n)-[:Published_to]->(y) WITH y AS n'; |
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
/** | |
* This will group a list of JSON objects (or any object) by a specific value defined by the user | |
* | |
* @example Example of a JSON object | |
* let example = [ | |
* { | |
* name: 'hello' | |
* }, | |
* { | |
* name: 'team' |
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
def permute(a): | |
""" | |
Permutes a list | |
""" | |
def toString(a): | |
return ''.join(a) | |
#Keep track of what we've outputted so we don't produce non-unqiue permutations | |
_current = set() | |
def merge(c, lists): |
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
def nextPrime(n=2): | |
def isPrime(num): | |
if(num == 2): | |
return True | |
for x in range(2, int(num/2) + 1): | |
if num%x == 0: | |
return False | |
return True | |
while(True): |
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
def nextInt(n=0): | |
while(true): | |
yield n | |
n = n + 1 | |
for num in nextInt(): | |
print(num) | |
input() |
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
void seive_of_eratosthenes(set<int> *nums, int max_value) { | |
set<int>::iterator it; | |
for(it = nums->begin(); it != nums->end(); it++){ | |
int num = *it; | |
for(int i = 2*num; i <= max_value; i+= num){ | |
nums->erase(i); | |
} | |
} | |
} |