Skip to content

Instantly share code, notes, and snippets.

View joeyklee's full-sized avatar

Joey Lee joeyklee

View GitHub Profile
@joeyklee
joeyklee / recursive-update-example.js
Created February 21, 2019 16:59
An example of using recursion to update a nested json file
let myList = {
"type": "list",
"name": "Hello world",
"description": "nestednesss!",
"features": [
{
"clientId": "-ACEnpvvPe",
"type": "list",
"name": "🌈",
"description": "",
@joeyklee
joeyklee / recursive-filter-remove.js
Created February 21, 2019 22:29
Nice use of filter and map to remove an item recursively found somewhere on stackoverflow
let myJson = {
"type": "list",
"name": "The P5.js Landscape",
"description": "This is a list of the P5.js landscape.",
"features": [
{
"type": "list",
"name": "Handy P5.js Tools",
"description": "This is a list of handy p5.js Tools ranging from commandline tools, project generators, and web editors.",
"features": [
@joeyklee
joeyklee / simple_crop.py
Created June 3, 2019 16:22
simple script to crop images
from PIL import Image
import os
# Getting the current work directory (cwd)
thisdir = os.getcwd() + "/images/santiago_urban_200/"
crop_rectangle = (36, 36, 164, 164)
# r=root, d=directories, f = files
for r, d, f in os.walk(thisdir):
for file in f:
@joeyklee
joeyklee / installing-node-module-with-g-flag.md
Created October 14, 2019 14:38
Installing & testing a node_module locally with -g flag

OK so here’s what I ended up doing:

let’s say I just I cloned magicbook

cd magicbook
npm install
npm install -g ./ 

the last command adds it the reference to this repo to the global node_modules

@joeyklee
joeyklee / diary-parser.js
Created October 29, 2019 05:04
quick demo for diary parser for student
const entries = `
10/12/2018 (Vancouver, Canada)
Today I flew to Vancouver and it was my first time in Canada. I can't believe how beautiful it is here.
My favorite thing about the city is how green it is and how beautiful the mountains are. I also love being on the ocean.
10/28/2019 (New York City, USA)
@joeyklee
joeyklee / index.html
Created December 4, 2019 15:39
example of converting image to base 64 for use in RunwayML
<html>
<head></head>
<body>
<img src="JL-sq.jpg" alt="" id="joey" />
<script>
const joey = document.querySelector('#joey');
toDataURL('JL-sq.jpg', function(dataUrl) {
const inputs = {
@joeyklee
joeyklee / nyc-dog-dataset-filterby-birthyear.js
Created April 14, 2020 17:36
Node.js script to filter json data based on some attribute
/**
Must be run in node.js
you can run this script by opening up your terminal:
```
$ node nyc-dog-dataset-filterby-birthyear.js
```
**/
const fs = require('fs');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.