Skip to content

Instantly share code, notes, and snippets.

View chrisbraddock's full-sized avatar

Chris Braddock chrisbraddock

View GitHub Profile
@chrisbraddock
chrisbraddock / large-xfer.sh
Last active October 31, 2016 11:58
transfer large amount of files - e.g. a large multi-terabyte directory with many subdirectories between physical drives
# -f If the destination file cannot be opened, remove it and create a new file, without
# prompting for confirmation regardless of its permissions. (The -f option overrides
# any previous -n option.)
# -p Cause cp to preserve the following attributes of each source file in the copy: mod-
# ification time, access time, file flags, file mode, user ID, and group ID, as
# allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs),
# including resource forks, will also be preserved.
#
# If the user ID and group ID cannot be preserved, no error message is displayed and
# the exit value is not altered.
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active March 26, 2026 21:24
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@quidmonkey
quidmonkey / proxy.js
Last active August 29, 2015 13:56
Node Proxy
// need to npm install http-proxy
require('http-proxy').createProxyServer({
port: 80, // if necessary
secure: false, // disable for self-signed certs
target: 'https://www.targetwebsite.com/'
}).listen(9000);
// boom baby, bye-bye development CORS issues!
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 24, 2026 02:07
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@keesiemeijer
keesiemeijer / functions.php
Created January 26, 2013 18:47
Adds filters to a query
<?php
// don't use the php tags when copying this in your own theme's functions.php
function add_new_query_vars($public_query_vars) {
$public_query_vars[] = 'posts_fields';
$public_query_vars[] = 'posts_join';
$public_query_vars[] = 'posts_where';
$public_query_vars[] = 'posts_orderby';
return $public_query_vars;
}