Skip to content

Instantly share code, notes, and snippets.

View traviskroberts's full-sized avatar

Travis Roberts traviskroberts

View GitHub Profile
@klappradla
klappradla / post-deploy.yml
Created November 27, 2015 12:12
Rake tasks as post deploy hooks for AWS Elastic Beanstalk Puma-Rails applications
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_do_stuff.sh" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
#! /usr/bin/env bash
# Using similar syntax as the appdeploy pre hooks that is managed by AWS
set -xe
@traviskroberts
traviskroberts / .htaccess
Created November 9, 2013 20:10
Basic maintenance page.
# Don't forget to turn on the rewrite engine
RewriteEngine on
# Maintenance Redirection (lets images and styles through)
RewriteCond %{REQUEST_URI} !maintenance.html
RewriteCond %{REQUEST_FILENAME} !(styles|images).+$
RewriteRule (.*) /maintenance.html [R,L]
@NoobsArePeople2
NoobsArePeople2 / gist:5121597
Last active November 10, 2023 14:33
Configure media keys on a non-Apple keyboard to control Spotify via AppleScript and USB Overdrive on OSX.

Requirements

  1. USB Overdrive
  2. A non-Apple keyboard with media keys (or keys you want to make "media" keys). For reference, I'm using a Microsoft Sidewinder X4

Set Up

  1. Plug in your keyboard and install USB Overdrive.
  2. Open USB Overdrive. Click into the Settings tab.
  3. Click the dropdown and select "Any Keyboard, Any Application"
@derekblank
derekblank / figures-of-peach.txt
Last active November 14, 2017 21:33
Figures of Peach
Cut me some slacks. There's more than one way to spin a cat.
The early bird gets to La Vergne, but you can't have cake and heat it too.
We can burn the British when we get there, but for now you need to come
down off your pedal stool, because to the victim go the spoils.
You're taking too much for granite and just preaching to require.
This is strong that broke the camel's back, so tape your pick:
You're either double's advocate or you're just making a half-harded effort.
Either way, you have a huge ship on your shoulder.
You're a hare's breath away from a wind-wind situation.
I know every road has its thorns, but you're getting too big for you bridges.
@traviskroberts
traviskroberts / cleaner_routes.rb
Last active October 3, 2015 17:58 — forked from dhh/gist:2492118
Route Organization
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}_routes.rb")))
end
end
BCX::Application.routes.draw do
draw :admin
draw :frontend
draw :resources
@traviskroberts
traviskroberts / sessions_clean.rake
Created March 31, 2012 20:10
Clear out Authlogic sessions table.
namespace :sessions do
desc "Clean out user sessions from the database."
task :clean => :environment do |variable|
ActiveRecord::SessionStore::Session.destroy_all(['updated_at < ?', 1.week.ago])
end
end
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]