Skip to content

Instantly share code, notes, and snippets.

@nz
nz / example-installation-testing-session.sh
Created February 12, 2012 23:34
Getting started with Bonsai.io's hosted ElasticSearch service
$ heroku addons:add elasticsearch:test
-----> Adding elasticsearch:test to bonsai-search... done, v51 (free)
$ heroku config | grep ELASTICSEARCH_URL
ELASTICSEARCH_URL => http://index.bonsai.io/pw4mw3d5y1rql88i44eo
$ curl 'http://index.bonsai.io/pw4mw3d5y1rql88i44eo/test?pretty=true' -d '{"test":"hello world"}'
{
"ok":true,
"_index":"pw4mw3d5y1rql88i44eo",
@ngs
ngs / gradient_support.rb
Created February 2, 2012 10:36
a patch to fix compass raising error when using 'transparent' keyword for gradiention: 'Expected a color. Got: transparent'
## If you are using under a rails project,
## I recommend to put this script onto config/initializer instead of applying the patch
module Compass::SassExtensions::Functions::GradientSupport
class ColorStop < Sass::Script::Literal
def initialize(color, stop = nil)
self.options = {}
if color.is_a?(Sass::Script::String) && color.value == 'transparent'
@aroop
aroop / GenerateImageThumbnailsJob.rb
Created February 1, 2012 07:45
Dragonfly image processor
class GenerateImageThumbnailsJob < Struct.new(:photo_id)
def perform
photo = Photo.find(photo_id)
photo.medium_image = photo.image.thumb('940x600')
photo.large_image = photo.image.thumb('450x')
photo.small_image = photo.image.thumb('172x167#c')
photo.save
end
@rmetzler
rmetzler / app.rb
Created January 22, 2012 12:51 — forked from jamiehodge/app.rb
Sinatra API for resumable.js
require 'sinatra'
require 'slim'
require 'coffee-script'
require 'sass'
require 'sequel'
DB = Sequel.sqlite
DB.create_table :uploads do
String :id, text: true, primary_key: true
@stevenhaddox
stevenhaddox / server_certificates_to_pem.md
Last active May 8, 2024 07:13
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@leshill
leshill / Procfile
Created November 28, 2011 20:01
Unicorn config for cedar stack on Heroku.
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
@mislav
mislav / Gemfile
Created August 31, 2011 21:48
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass'
end
@pjkelly
pjkelly / setup-vmware-image-with-static-IP.markdown
Created July 7, 2011 01:06
VMWare Fusion Images with a static IP Address on Mac OS X Snow Leopard

How to setup your VMWare Fusion images to use static IP addresses on Mac OS X

At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base a

@pjkelly
pjkelly / install-apt-file.sh
Created July 7, 2011 01:00
Not sure what apt-get package contains a file?
# credit: http://crshlv.ly/qkAzW0
#
# I found this especially useful when trying
# to figure out equivalent apt-get packages
# for certain Perl CPAN modules.
apt-get install apt-file
apt-file update
apt-file search URI::Escape
@pjkelly
pjkelly / DevelopmentEnvironmentInstructions.markdown
Created December 13, 2010 17:13
Instructions for setting up a Rails development environment using Cinderella

These instructions are for Snow Leopard only.

XCode

Ensure that you have XCode for the version of OS X you're running. These are not installed by default on new machines and can be installed off the OS installation DVD. If you're not sure, run the following command. It should return something like this: /usr/bin/gcc; if it does not, you need to install XCode.

which gcc

SSH Keys