Skip to content

Instantly share code, notes, and snippets.

View tim-phillips's full-sized avatar

Tim Phillips tim-phillips

  • Los Angeles
View GitHub Profile
@tim-phillips
tim-phillips / find-and-sed.sh
Created September 27, 2023 18:33
When you want to run sed on multiple files
find . -type f -name "*" -print0 | xargs -0 sed -i "s/can't/can/g"
@tim-phillips
tim-phillips / removeNulls.js
Last active July 16, 2021 20:46
removes keys with null values
function removeNulls (obj) {
Object.keys(obj).forEach(key => {
if (obj[key] && typeof obj[key] === 'object') removeNulls(obj[key])
else if (obj[key] == null) delete obj[key]
})
}
@tim-phillips
tim-phillips / convertDateToReadableString.js
Last active September 10, 2020 21:12
Converts ISO 8601 date string to human readable date string
function convertDateToReadableString (date) {
if (!date) return
const d = new Date(date.replace('-', '/'))
return d.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
})
}
{
"scripts": {
"inspect": "npx -n --inspect <command>"
}
}

Keybase proof

I hereby claim:

  • I am tim-phillips on github.
  • I am timphillips (https://keybase.io/timphillips) on keybase.
  • I have a public key ASDM2xrS-uzauIms1_pXYIYOYJFi4xWJwfGz8HWxXOMVGgo

To claim this, I am signing this object:

@tim-phillips
tim-phillips / airtable-proxy.js
Created April 1, 2018 23:05 — forked from benoror/airtable-proxy.js
Node.js Airtable API Proxy
var express = require('express');
var proxy = require('http-proxy-middleware');
var options = {
logLevel: 'debug',
target: 'https://api.airtable.com/v0/' + process.env.APP_ID,
changeOrigin: true,
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + process.env.API_KEY
},
@tim-phillips
tim-phillips / slim-redux.js
Created September 15, 2017 00:39 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {