Skip to content

Instantly share code, notes, and snippets.

@nicerobot
nicerobot / README.md
Last active June 18, 2024 19:46
Mac OS X uninstall script for packaged install of node.js from https://stackoverflow.com/a/9287292/23056

To run this, you can try:

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh
@jsahlen
jsahlen / plexconnect.conf
Created August 24, 2013 09:49
Nginx config for PlexConnect running on port 8091
server {
server_name trailers.apple.com atv.plexconnect;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8091;
}
@phlik
phlik / urlRewriteReverseProxy.js
Created February 25, 2014 14:37
Simple reverse proxy in node with url rewrite.
var http = require('http');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
http.createServer(function(req, res){
if(/^\/api/.test(req.url)){
req.url = req.url.replace(/^\/api/, "");
proxy.web(req, res, {target:'http://localhost:7889'});
} else {
@coolaj86
coolaj86 / github-pages-https-lets-encrypt.md
Last active November 16, 2021 22:36
Github Pages: Let's Encrypt!
@ezekg
ezekg / profile.md
Last active March 3, 2024 23:52
iTerm key bindings

Open the iTerm preferences ⌘+, and navigate to the Profiles tab (the Keys tab can be used, but adding keybinding to your profile allows you to save your profile and sync it to multiple computers) and keys sub-tab and enter the following:

Delete all characters left of the cursor

⌘+←Delete Send Hex Codes:

  • 0x18 0x7f – Less compatible, doesn't work in node and won't work in zsh by default, see below to fix zsh (bash/irb/pry should be fine), performs desired functionality when it does work.
  • 0x15 – More compatible, but typical functionality is to delete the entire line rather than just the characters to the left of the cursor.

Delete all characters right of the cursor

⌘+fn+←Delete or ⌘+Delete→ Send Hex Codes:

  • 0x0b
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@jlaustill
jlaustill / gitStatsAllTime.sh
Last active April 8, 2021 20:46
Get the user stats for the previous month from a git repo
#!/usr/bin/env bash
format=${1:-pretty}
#if [[ "$OSTYPE" == "linux-gnu" ]]
#then
#from=$(date -d "last month" +"%d %b %Y")
#to=`date +"%d %b %Y"`
#else
#from=`date -v-1m`
#to=`date`
#fi
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2024 15:39
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@kiliman
kiliman / README.md
Last active June 20, 2024 20:46
Debug server-side Remix using VSCode

💡 HOWTO: Debug your server-side Remix code using VSCode

✨ New in Remix v1.3.5

The latest release of Remix fixes sourcemaps so you no longer need to use any hacks to set breakpoints in your route modules. Simply start the debugger and Remix will hit the breakpoint in your loaders and actions.

Debugging session even survives edits and Live Reload.