Skip to content

Instantly share code, notes, and snippets.

View jimneath's full-sized avatar

Jim Neath jimneath

View GitHub Profile
{"data":{"pricingTiers":[{"tierStem":"0","tierName":"Free","pricingInfo":[{"country":"United States","countryCode":"US","currencySymbol":"$","currencyCode":"USD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Canada","countryCode":"CA","currencySymbol":"$","currencyCode":"CAD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Mexico","countryCode":"MX","currencySymbol":"$","currencyCode":"MXN","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Australia","countryCode":"AU","currencySymbol":"$","currencyCode":"AUD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"New Zealand","countryCode":"NZ","currencySymbol":"$","currencyCode":"NZD","wholesalePrice":0.00,"retailPrice":0.00,"fRetailPrice":"$0.00","fWholesalePrice":"$0.00"},{"country":"Japan","countryCode":"JP","currencySymbol":"¥","currencyCode":"
if node[:ruby_version][/ruby 1\.9/i]
enable_package "media-gfx/imagemagick" do
version "6.7.8.8-r1"
end
package "media-gfx/imagemagick" do
version "6.7.8.8-r1"
action :install
end
# deploy.rb
namespace :ts_remote do
task :conf do
run <<-CMD
cd #{current_release}
&&
RAILS_ENV=#{rails_env} rake ts:conf
&&
rsync --progress #{current_release}/config/#{rails_env}.sphinx.conf sphinxsearch@db-server:/home/sphinxsearch/
for i in `find /data -maxdepth 1 -type d ! -name "monit.d" ! -name "nginx" ! -name "lost+found" ! -name "homedirs" ! -name "data"`;
do
appname=`echo ${i} | awk -F/ '{print $3}'`
version=''
if [ -f $i/current/Gemfile.lock ];
then
version=`egrep "^ *rails \([0-9\.]+\)" $i/current/Gemfile.lock | egrep -o "[0-9\.]+"`
else
version=`gem list | egrep -o "^rails \([^,\)]+" | egrep -o "[0-9\.]+"`
@jimneath
jimneath / gist:1988860
Created March 6, 2012 20:41
Post new review response
{
"response": {
"uuid": "7446FE77-E877-4836-A30F-69AD8C0Esff4761-55747-0000DA3697EFD3E7",
"review_uuid": "102fe9541253cddc638e40b9fdfb4bfb4be81c50c8de857c0280c4b126389b91503b88dc5890f8202c9d88aecdbf1a7d234ac9bbb2e666256b817d24",
"created_at": "2012-03-06 12:00:00",
"start_time": "2012-03-06 14:25:09",
"end_time": "2012-03-06 14:25:15",
"ratings_attributes": [
{
"rating_type": "Client Scores Competitor",
@jimneath
jimneath / gist:1988653
Created March 6, 2012 19:58
Post a new review
{
"review": {
"name": "Dasdasd",
"competitor_ids": [40, 5, 22, 13, 20],
"uuid": "039E44B7-9643-42A8-801D-8D53BB130573-44532-0000C4D78224DF74",
"created_at": "2012-03-05 21:57:08",
"client_id": 27
}
}
@jimneath
jimneath / config.ru
Created March 2, 2012 11:36
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
require "rails"
@jimneath
jimneath / migrate_s3.rake
Created March 1, 2012 13:33
rake task to migrate paperclip attachments to Amazon S3
namespace :attachments do
task :migrate_to_s3 => :environment do
require 'aws/s3'
# Load credentials
s3_options = YAML.load_file(File.join(Rails.root, 'config/s3.yml')).symbolize_keys
bucket = s3_options[:bucket_name]
# Establish S3 connection