This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def snippet(thought, wordcount) | |
thought.split[0..(wordcount-1)].join(" ") +(thought.split.size > wordcount ? "..." : "") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Convert a mysql dump into a sqlite-compatible format. | |
# I wrote this for just one script... no guarantess that it will work with others... | |
# python fsql.py < mysqldump.sql > readyforsqlite.sql | |
import re | |
import sys | |
content = sys.stdin.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace(:db) do | |
desc "Pulls remote DB and saves to file." | |
task :pull, :roles => :web do | |
load 'config/environment.rb' | |
abcs = ActiveRecord::Base.configurations | |
curr_date = Time.new | |
timestamp = curr_date.mon.to_s + "_" + curr_date.day.to_s + "_" + curr_date.hour.to_s + "_" + curr_date.min.to_s | |
run "mysqldump -h#{abcs[stage.to_s]["host"]} -u#{abcs[stage.to_s]["username"]} --password=#{abcs[stage.to_s]["password"]} #{abcs[stage.to_s]["database"]} > #{shared_path}/#{stage.to_s}_data_#{timestamp}.sql" | |
run "cd #{shared_path} && tar -czvf #{shared_path}/#{stage.to_s}_data_#{timestamp}.sql.tar.gz #{stage.to_s}_data_#{timestamp}.sql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.connect "faqs.html", :controller => "main", :action =>"faqs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.connect "faqs.php", :controller => "main", :action =>"faqs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName domain.com | |
DocumentRoot "/home/deploy/domain.com/current/public" | |
RailsEnv production | |
AddHandler passenger .php #added to support legacy routes | |
<Directory "/home/deploy/domain.com/current/public"> | |
Order allow,deny | |
Allow from all | |
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tn = params[:tn][:tracking_number] | |
@tns = @tn.split(',') | |
if @tns.count >= 2 | |
@tns.each do |tn| | |
@tracking_number = TrackingNumber.new | |
@tracking_number.tracking_number = tn | |
@tracking_number.order_id = @order.id | |
@tracking_number.save | |
count +=1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @menu.special_action ="contact" | |
def show | |
@menu = Menu.find(params[:id]) | |
@resource = @menu.resource | |
unless @menu.special_action.nil? | |
render @menu.special_action.to_sym | |
else | |
render 'show' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="id_0"> | |
<li id="id_1">1.0</li> | |
<li id="id_2">2.0</li> | |
<li id="id_3">3.0 | |
<ul> | |
<li id="id_4">3.1</li> | |
<li id="id_5">3.2</li> | |
</ul> | |
</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.namespace :admin do |admin| | |
admin.resources :news, :collection => {:post_data => :post, :sort => :post, :search => :post} | |
end | |
$ rake routes | grep news | |
search_admin_news POST /admin/news/search(.:format) {:controller=>"admin/news", :action=>"search"} | |
post_data_admin_news POST /admin/news/post_data(.:format) {:controller=>"admin/news", :action=>"post_data"} | |
sort_admin_news POST /admin/news/sort(.:format) {:controller=>"admin/news", :action=>"sort"} | |
admin_news_index GET /admin/news(.:format) {:controller=>"admin/news", :action=>"index"} |
OlderNewer