Skip to content

Instantly share code, notes, and snippets.

View guangbochen's full-sized avatar
👨‍👩‍👧‍👦
orchestration

Guangbo guangbochen

👨‍👩‍👧‍👦
orchestration
View GitHub Profile
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@colindean
colindean / vagrant-scp.sh
Last active November 21, 2023 03:27
A quick way to transfer a file to the home directory on a Vagrant VM
#!/bin/sh
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} "$@" || echo "Transfer failed. Did you use 'default:' as the target?"
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*