Skip to content

Instantly share code, notes, and snippets.

View freegenie's full-sized avatar

Fabrizio Regini freegenie

View GitHub Profile
require 'spec_helper'
describe Network::SearchController do
before do
request.env['HTTPS'] = 'on'
end
describe '#global' do
context 'anonymously' do
@freegenie
freegenie / mongo_backup.rb
Created August 18, 2010 09:04
Backup solution for mongodb which dumps gridfs items on filesystem
#!/usr/bin/env ruby
# This script is a backup tool for mongodb.
#
# The main purpose is to dump files from gridfs to filesystem,
# to take advantage of backup solutions based on tools like
# rsync.
# Developed against mongo 1.6.0
require 'rubygems'
require 'mongo_mapper'
require 'joint'
require 'shoulda'
MongoMapper.database = 'joint_exif_test'
class Photo
include MongoMapper::Document
#!/bin/bash
# This script is supposed to be executed on the
# machine which hosts the database.
#
# What it does is to dump the entire database in
# separate directories, and then tgzip each single
# database.
# Example:
class Asset
include MongoMapper::Document
plugin Joint
# Next time use '#' hash mark to crop images. i.e. #200x250
Thumbs = { :detail => "440x300>", :medium => "220x150>", :little => "100x60>", :highlights => 'crop-200x250' }
attachment :file
# Git hook to switch config files made for a Rails app
# Looks for config file named like the branch.
#
# i.e.: database.mybranch.yml
#
# If the file is found, copies that to the actual config
# overwriting the previous one.
#
# The third parameter is 1 when we are switching branches
#