Skip to content

Instantly share code, notes, and snippets.

View psahni's full-sized avatar

Prashant psahni

View GitHub Profile
@psahni
psahni / ruby_hosting
Created October 20, 2011 13:33
Blog - Ruby On Rails Hosting
Resources
---------
http://www.boogiejack.com/hosting/what-is-shared-hosting.html
http://www.mybestratedwebhosting.com/tips/cloud-hosting-vs-shared-hosting.html [ Good ]
http://www.smallcloudbuilder.com/hosting/articles/395-cloud-vs-shared-hosting-whats-the-difference
http://www.brilliantthinking.net/2009/10/16/cloud-vs-traditional-hosting/
Ruby on Rails hosting options
@psahni
psahni / formatted_website_link.rb
Created October 29, 2011 10:11
formatted website link/url helper
@psahni
psahni / gist:1324417
Created October 29, 2011 12:56
formatted date/time
* obj.created_at.strftime("%I:%M %p")
# Output:
# 12:53 PM
# 03:53 AM
e.start.strftime("%B %d, %Y")
#Output
"October 29, 2011"
@psahni
psahni / manilman
Created November 23, 2011 08:55
mailman
Mailman v0.4.0 started
POP3 receiver enabled ([email protected]@pop.gmail.com).
Polling enabled. Checking every 60 seconds.
/home/prashant/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/pop.rb:979:in `check_response': * OK Gimap ready for requests from 122.177.151.250 g5if4077877pbt.39 (Net::POPError)
from /home/prashant/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/pop.rb:872:in `initialize'
from /home/prashant/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/pop.rb:551:in `new'
from /home/prashant/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/pop.rb:551:in `do_start'
from /home/prashant/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/pop.rb:528:in `start'
from /home/prashant/.rvm/gems/ruby-1.9.2-p290@opso/bundler/gems/mailman-70382c3c32bd/lib/mailman/receiver/pop3.rb:29:in `connect'
from /home/prashant/.rvm/gems/ruby-1.9.2-p290@opso/bundler/gems/mailman-70382c3c32bd/lib/mailman/application.rb:57:in `block in run'
@psahni
psahni / imp_git_repo
Created February 2, 2012 18:02
Good git repositories with rails apps open source
https://github.com/alphagov
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
Animals.each do |letter, results|
10.times do
doc = Nokogiri::HTML(open("http://www.ocar.org/page.php?tut=realtor-affiliate-search-results&tid=802&pid=8&first_or_last_name=#{letter}&city=&office=&btc=&op=find_a_realtor&ftut=find-a-realtor&start=#{results_per_page}"))
realtors = {}
('a'..'z').each do |n|
realtors[n] = Realtor.create
end
doc.css('div.search_results_item').each do |number|
phone_number = /\(\d{3}\)\s\d{3}-\d{4}/.match("#{number.content}")
('a'..'z').each do |n|
require 'spec_helper'
feature "Editing tickets" do
let!(:project) { Factory(:project) }
let!(:ticket) { Factory(:ticket, :project => project) }
before do
visit '/'
click_link project.name
click_link ticket.title
@psahni
psahni / deploy.rb
Created August 24, 2012 13:15 — forked from markoa/deploy.rb
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom: