Skip to content

Instantly share code, notes, and snippets.

View krhancoc's full-sized avatar

Ryan Hancock krhancoc

View GitHub Profile
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 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'
@krhancoc
krhancoc / gen3.py
Last active February 26, 2017 21:38
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):
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):
@krhancoc
krhancoc / gen1.py
Last active February 23, 2017 19:47
def nextInt(n=0):
while(true):
yield n
n = n + 1
for num in nextInt():
print(num)
input()
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);
}
}
}