Skip to content

Instantly share code, notes, and snippets.

View rubengmurray's full-sized avatar
💻

Reece Daniels rubengmurray

💻
View GitHub Profile
git branch --merged master | egrep -v '(^\*|master|dev)' | xargs git branch -d
-- COUNT ITEMS BY DATE INTERVAL
SELECT
DATE_TRUNC('hour', my_date_field), -- or second, minute, hour, day, week, month, year
COUNT(id)
FROM my_table
WHERE my_field IS NOT NULL
GROUP BY 1
ORDER BY 2 DESC
@rubengmurray
rubengmurray / gist:0f9bf75bb1d917a4ec48dda5d3df722f
Last active June 6, 2023 19:01
Convert CommonJS to ESM imports with find + replace
In your preferred editor navigate to the search/find + replace section
- In find: `(?<='\.)(.*?)(?=')`
- In replace: `$1.js`
This will replace all imports beginning with `.`, ending with `'` to a `.js` file ending.
// It will not match these
import p from '@scoped/npm_package'
import p from 'npm_package'