Skip to content

Instantly share code, notes, and snippets.

View xdite's full-sized avatar

Yi-Ting Cheng xdite

View GitHub Profile
@xdite
xdite / gist:6419
Created August 20, 2008 17:55
Google AutoLogin
require 'net/http'
require 'net/https'
require 'cgi'
require 'uri'
require 'rubygems'
require 'hpricot'
module Net
class HTTPS < HTTP
def initialize(address, port = nil)
SELECT count(id) as hits,
LEFT(created_at,10) as created_on,
event_id FROM `visits` WHERE (left(created_at,10) = '2008-08-20' and type = 'EventVisit') AND ( (`visits`.`type` = 'EventVisit' ) ) GROUP BY created_on, event_id ORDER BY created_on DESC, event_id ASC
# 先在你的 PHP WebApplication 的根目錄建一個目錄, 叫 config , 裡面放置此 rb
# 官方文件 http://www.capify.org/getting-started/rails
# Capistrano PHP http://www.simplisticcomplexity.com/2006/8/16/automated-php-deployment-with-capistrano/
# Capistrano 會用到許多 rake 技巧
# rake 教學請看 http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial
# rake 教學中文版請看 http://hi.baidu.com/%D0%C7203/blog/item/ebda2dd09f1d698ea1ec9c7a.html
#
# ---
# 前置動作
# cd /blah/project
作者 dbn (DBN) 看板 Blog
標題 [情報] 痞客邦改網址不影響 PageRank?
時間 Thu Aug 21 23:08:24 2008
───────────────────────────────────────
同一篇公告
http://0rz.tw/ef4HX
但是官方加了一行:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://registrano.com/events/ff08a0" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
namespace :deploy do
desc "Create database.yml and asset packages for production"
task :after_update_code, :roles => [:web] do
db_config = "#{shared_path}/config/database.yml.production"
run <<-EOF
cp #{db_config} #{release_path}/config/database.yml
EOF
run <<-EOF
? test/unit/email_test.rb
? test/functional/channel_posts_controller_test.rb
? test/functional/user_channels_controller_test.rb
? test/fixtures/emails.yml
? app/models/user_notifier.rb
? app/models/email.rb
M app/models/user.rb
M app/controllers/users_controller.rb
? app/views/user_notifier
? app/views/users/forgot.html.erb
class BlogsController < ApplicationController
def index
@posts = Post.find(:all)
end
def show
@post = Post.find(params[:id])
end
<h1>New post</h1>
<% form_for :post , :url => blogs_path do |f| -%>
<%= f.error_messages %>
<div><label>subject</label><%= f.text_field :subject %></div>
<div><label>content</label><%= f.text_area :content %> </div>
<%= f.submit "Submit", :disable_with => 'Submiting...' %>
<% end -%>
<h1>My Blog</h1>
<h2><%= link_to 'New post', new_blog_path %></h2>
<table>
<tr>
</tr>
<% for post in @posts %>
<tr>
<td><%= post.subject %> </td>
<td><%= link_to 'Show', blog_path(post) %></td>