Skip to content

Instantly share code, notes, and snippets.

@mattfawcett
mattfawcett / gist:72340
Created March 1, 2009 14:22
Sync your development database and file upload folders with whatever your staging/production server currently has
# Task has the following dependencies
# net/ssh gem [gem install net-ssh]
# net/sftp gem [gem install net-sftp]
# rsync command line utility
# yamb_db rails plugin [ruby script/plugin install git://github.com/adamwiggins/yaml_db.git]
desc "This task will make your development environment download and import a fresh copy of your staging database and also sync any folders such as image uploads so you can quickly replicate your staging/production server content locally"
task :sync_with_staging => :environment do
@remote_host = 'yourremoteserver.com'
@remote_user = 'yoursshuser'
@mattfawcett
mattfawcett / Init Script for Nginx when compiled from Passenger Installer
Created April 18, 2009 19:23
Init Script for Nginx when compiled from Passenger Installer
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@mattfawcett
mattfawcett / first_names.yml
Created October 16, 2009 13:31
A YAML file of first names along with possible genders
names:
aaliyah:
genders: "f"
aapeli:
genders: "m"
aapo:
genders: "m"
aaren:
genders: "mf"
aarne:
@mattfawcett
mattfawcett / gist:220512
Created October 28, 2009 14:31
sample CSV for spider
"country_id","affiliate_id","competition_id","date_of_aquasition","title","first_name","lastname","password","email_address","mobile_number","NMS Terms","Promotions"
"UK",4,113,04/12/09,"Mr","Matt","Fawcett","mypass123","matt@bolseragency.com","447703001060","Yes","Yes"
"IT",5,114,04/12/09,"Dr","Sam","Levy","samspass123","sam@bolseragency.com","sdsdsddsd","Yes","Yes"
"UK",4,"Invalid","Invalid","Invalid","Invalid","Invalid","Invalid","Invalid","Invalid","Invalid","Invalid"
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- --------------------------------------------------------
--
-- Table structure for table `dialing_codes`
--
CREATE TABLE IF NOT EXISTS `dialing_codes` (
`Country` varchar(128) NOT NULL,
require 'rubygems'
gem 'activesupport', :version => "2.3.4"
require 'activesupport'
gem 'mongo_mapper', :version => "0.6.0"
require 'mongo_mapper'
MongoMapper.database = "mongo_mapper_issue_test"
require 'net/http'
require 'net/https'
url = URI.parse('https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/1234567890')
req = Net::HTTP::Post.new(url.path)
req.set_form_data({'my'=>'params'})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
require 'rubygems'
require 'sinatra'
get "/" do
file_name = '20100108-095851-BSMsgLog.csv'
if File.exists?(file_name)
file = File.open(file_name, "r")
contents = file.read
file.close
FileUtils.rm(file_name)
require "rubygems"
require "sinatra"
get "/" do
"Hello World"
end
find . -name '*.rb' | xargs egrep -lRZ '\.make' | xargs -0 sed -i -e '/make!/!s/\.make/\.make_unsaved/g' | grep make_unsaved
find . -name '*.rb' | xargs egrep -lRZ '\.make' | xargs -0 sed -i -e 's/\.make!/\.make/g' | grep make