Skip to content

Instantly share code, notes, and snippets.

View joshblack's full-sized avatar

Josh Black joshblack

View GitHub Profile
const scoped = {
foo: () => 'foo',
bar: () => 'bar',
baz: { a: 'b' },
arr: [0]
};
const evalify = (code, scope) => {
const variables = Object.keys(scope)
.map((name) => {
// Extends Tom Hanks co-actors, to find co-co-actors who haven't worked with Tom Hanks...
MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors),
(coActors)-[:ACTED_IN]->(m2)<-[:ACTED_IN]-(cocoActors)
WHERE NOT (tom)-[:ACTED_IN]->(m2)
RETURN cocoActors.name AS Recommended, count(*) AS Strength ORDER BY Strength DESC
// Find someone to introduce Tom Hanks to Tom Cruise
MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors),
(coActors)-[:ACTED_IN]->(m2)<-[:ACTED_IN]-(cruise:Person {name:"Tom Cruise"})
RETURN tom, m, coActors, m2, cruise

Tries

Lecture

Notes

Goal is given a text T and pattern P (where the strings exist over ), find some or all the occurences of P in T as a substring.

Trie node representation

/**
* Given two item objects with the following shape:
*
* {
* x: number,
* y: number,
* width: number,
* height: number
* }
*

Ops Terms

  • daeomon: A computer program that runs as a background process, rather than being under the direct control of an interactive user
  • broker: In distributed computing, an object request broker (ORB) is a middleware which allows program calls to be made from one computer to another via a computer network.

Database

  • partition: a division of a logical database into distinct, independent parts.
    • Normally done for performance, availability, or management reasons
  • Horizontal partitioning: putting different rows into different tables
/**
* Collection of utility functions used for querying React-specific Nodes
*/
const utils = (j) => {
const findComponentClassExportDefault = (path) =>
path.find(j.ExportDefaultDeclaration, {
declaration: {
type: 'ClassDeclaration',
superClass: {
import { check, gen, property } from 'testcheck';
import generate from 'babel-generator'
import babel from 'babel-core';
const genTrue = gen.suchThat((v) => v, gen.boolean);
const genFalse = gen.suchThat((v) => !v, gen.boolean);
const letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
window.styles = [];
window.formatStyles = function () {
return styles.map(({ className, properties }) => {
const props = properties.map(
(prop) => `${prop.key.name}: ${prop.value.value};`).join('\n');
return '.' + className + ' {' + '\n' + props + '\n}\n';
}).join('\n');
};