Skip to content

Instantly share code, notes, and snippets.

@bartimaeus
bartimaeus / posts_controller.rb
Created August 7, 2013 15:14
Thanks sheeny! here is the final working solution with your help
...
def posts_params
params[:post][:tags] = params[:post][:tags].split(",") if params[:post][:tags].is_a? String
params.require(:post).permit(:title, :content, :tags => [])
end
end
@bartimaeus
bartimaeus / update-dns.sh
Created November 13, 2012 06:47
Init script to run local dns update script for Route53
#!/bin/bash
su - ubuntu -c "ruby $HOME/bin/update-dns.rb"
@bartimaeus
bartimaeus / update-dns.rb
Created November 13, 2012 06:45
Script to Update Route53 with an EC2 Instance IP Address
# /home/ubuntu/bin/update-dns.rb
require 'rubygems'
require 'open-uri'
require 'route53'
zone = "bartimae.us"
record_type = "A"
ip_address = open("http://169.254.169.254/latest/meta-data/public-ipv4") { |f| f.read }
@bartimaeus
bartimaeus / update-dns.rb
Created November 8, 2012 17:59
Updated Route53 Record When EC2 Instance Starts
# /home/ubuntu/bin/update-dns.rb
require 'rubygems'
require 'open-uri'
require 'route53'
zone = "bartimae.us"
record_type = "A"
ip_address = open("http://169.254.169.254/latest/meta-data/public-ipv4") { |f| f.read }
@bartimaeus
bartimaeus / gist:3935419
Created October 22, 2012 23:21 — forked from dougwaldron/gist:1151942
More Chrome Inspector CSS
/* Additional styles for Chrome Inspector; should be used with
http://darcyclarke.me/design/skin-your-chrome-inspector/
and
http://dpaste.com/hold/595890/
*/
#elements-content li.hovered:not(.selected) .selection {
/* hover color */
background: rgba(255, 255, 255, .2) !important;
}
#elements-content .selection.selected {
@bartimaeus
bartimaeus / mountain-lion-brew-setup.markdown
Created September 11, 2012 19:56 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@bartimaeus
bartimaeus / unicorn.rb
Created June 30, 2012 04:27
Sample unicorn.rb config for Rails
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
@bartimaeus
bartimaeus / [app_name]
Created June 30, 2012 04:08
Nginx config for rails application
#
# These are some basic settings for nginx.
# If it's not installed, install via `apt-get install nginx`
# Many pieces of this config came from other people's settings. Sorry for the lack of attribution.
#
upstream [app_name]_unicorn {
server unix:/tmp/[app_name].sock;
}
@bartimaeus
bartimaeus / [app_name].sh
Created June 30, 2012 03:58
Init script for rails application, originally developed by mikesmullin
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@bartimaeus
bartimaeus / visudo
Created June 30, 2012 03:55
Allow rvm user to restart the application via capistrano
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset