Skip to content

Instantly share code, notes, and snippets.

Ryan Burnette ryanburnette

Block or report user

Report or block ryanburnette

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@branneman
branneman / better-nodejs-require-paths.md
Last active Dec 13, 2019
Better local require() paths for Node.js
View better-nodejs-require-paths.md

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

@trey
trey / Gruntfile.js
Last active Oct 22, 2018
This is a braindump of the first time I was actually able to get Grunt to do all of what I wanted.
View Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {},
}
},
@christianberg
christianberg / create-docker-droplet.sh
Last active Oct 13, 2019
Shell script to create a Digital Ocean Droplet and install docker
View create-docker-droplet.sh
#!/bin/bash
set -e
SECRETFILE=~/.digitalocean
if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then
if [ -e $SECRETFILE ]; then
. $SECRETFILE
fi
fi
@alvarobp
alvarobp / remote_pairing_setup.md
Last active Jan 18, 2018
Setting up a remote pair station with SSH + TMUX and/or Reverse SSH Tunnel
View remote_pairing_setup.md

Disclaimer: The following examples try to give an overview of the process followed in different scenarios. Some commands were actually written from memory. Some tools might exist simplifying all this. Furthermore, I'm no expert so if anyone ever reads this and knows any improvement, please let me know.

Case 1: Direct access to Pairing Station

Given that the Guest User can access the Pairing Station directly, either because the station is publicly available or because NAT port forwarding can be used, there's only one thing we need to do, give ssh access to the Guest User by adding his ssh public key to our Local User (pair) .ssh/authorized_keys file.

The local user would open up a tmux session with

tmux new-session -s pairing
@cheeaun
cheeaun / js-error-logging-services.md
Last active Oct 18, 2019
JavaScript error logging services
View js-error-logging-services.md
@clarkdave
clarkdave / chef-insert-line-if-no-match.rb
Created Jun 13, 2013
[CHEF] Insert a line in a file if it doesn't already exist
View chef-insert-line-if-no-match.rb
line = '127.0.0.1 gateway.internal gateway'
file = Chef::Util::FileEdit.new('/etc/hosts')
file.insert_line_if_no_match(/#{line}/, line)
file.write_file
@westonruter
westonruter / gist:5475349
Last active Feb 6, 2017 — forked from markjaquith/gist:2653957
WordPress Fragment Caching convenience wrapper
View gist:5475349
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
@ggl
ggl / htpasswd.pl
Last active Jul 18, 2019
htpasswd in perl, no need to install apache tools
View htpasswd.pl
#!/usr/bin/env perl
#
# htpasswd.pl
#
# Copyright (c) 2013, Gelu Lupas <gelu@devnull.ro>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
@tyabe
tyabe / better_errors_plugin.rb
Created Dec 16, 2012
This is Padrino Plugin for better_errors.
View better_errors_plugin.rb
##
# Better Errors plugin on Padrino
#
# https://github.com/charliesome/better_errors
#
GEMFILE = <<-GEMFILE
# Better Errors
group :development do
You can’t perform that action at this time.