Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Looking for work!

EJ Fox ejfox

💪
Looking for work!
View GitHub Profile
View import.cypher
// CLEAR DATA
MATCH (n:Officer) DETACH delete n;
MATCH (n:Incident) DETACH delete n;
MATCH (n:Precinct) DETACH delete n;
MATCH (n:Penalty) DETACH delete n;
// SET CONSTRAINTS
CREATE CONSTRAINT officerIdConstraint ON (officer:Officer) ASSERT officer.id IS UNIQUE
CREATE CONSTRAINT incidentIdConstraint ON (incident:Incident) ASSERT incident.id IS UNIQUE
CREATE CONSTRAINT precinctIdConstraint ON (precinct:Precinct) ASSERT precinct.id IS UNIQUE
@ejfox
ejfox / import.cypher
Created May 6, 2021
Import CSV with Neo4J Cypher
View import.cypher
// clear data
MATCH (n:Officer) delete n;
MATCH (n:Incident) delete n;
MATCH (n:Precinct) delete n;
MATCH (n:Penalty) delete n;
CREATE CONSTRAINT officerIdConstraint ON (officer:Officer) ASSERT officer.id IS UNIQUE
View my_happiness_2020.csv
Parsed Date happiness total social energy wellness
2019-07-10 48.25351918 83.88230576 97.03125003 148.7255695 238.6566667
2019-07-11 149.6123334 98.34205408 185.3835502 94.47351362 249.3607796
2019-07-12 151.5025529 100 181.2305023 131.2680142 335.0919097
2019-07-13 104.975604 76.02830081 130.5435739 24.72176457 93.05885718
2019-07-14 106.9930615 79.22556595 70.54415526 50.38911631 176.7435962
2019-07-15 48.49782752 69.34323403 134.5885842 49.3129526 116.4604166
2019-07-16 65.89493656 88.01984618 181.9219129 94.17121736 127.9488072
2019-07-17 65.7430037 87.16667812 133.5655477 91.4792567 234.0841979
2019-07-18 78.91884416 86.8878136 95.92553568 80.09017738 245.2977639
@ejfox
ejfox / ndplayer.processing
Created Feb 10, 2021
Doomscroller Processing Script
View ndplayer.processing
PImage img; // Declare a variable of type PImage
float yScroll = 0;
// float scrollAmt = 50;
float threshold = 127;
PImage destination;
int lines = 1;
int scrollStart = 768;
float scrollScreens;
int revealAmt;
View groupByCounty.mjs
import find from 'lodash/find'
import filter from 'lodash/filter'
import sortBy from 'lodash/sortBy'
import fs from 'fs'
//import nest from 'd3-collection'
import * as collection from 'd3-collection'
let argv = process.argv
View package.json
{
"name": "prerender",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
View alex4.js
const { load } = require("@alex.garcia/observable-prerender");
const puppeteer = require("puppeteer");
async function main() {
let mapWidth = 1920
let mapHeight = 1080
// let startDate = "20200301"
let startDate = "20200122"
View index.js
// Modified from https://github.com/siegfriedgrimbeek/cheerio-pagination-tutorial
// Thanks to Siegfried for open sourcing this
// I only modified it a tiny bit to work for qmap
// External dependencies
const axios = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
const chalk = require('chalk')