Skip to content

Instantly share code, notes, and snippets.

@ascendbruce
ascendbruce / gist:7558475
Created November 20, 2013 06:03
用 request-log-analyzer 分析 rails 的 log

先安裝 request-log-analyzer gem,建議把 log 檔抓到自己電腦來做分析。

gem i request-log-analyzer

分析某一個 log 檔

request-log-analyzer log/production.log --output HTML --file tmp/log_report.html

指定多個 log 檔

@stevenyap
stevenyap / Rails Controller.md
Created October 19, 2013 13:58
Rails controller cheatsheet

Flash

# supports only notice and alert by default
# the rest has to go into flash hash
redirect_to :index, notice: "success"
redirect_to :new, notice: "errors"
redirect_to :new, flash: { success: "yeah" }
flash[:info] = "updated"
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@tjh
tjh / character_set_and_collation.rb
Created January 31, 2012 16:07
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''

Welcome to #rubyonrails

Please behave in a polite, considerate and inclusive manner in the channel at all times. People volunteer their time in the channel to help people like you with your Rails problems and some respect (in both directions) will go an extremely long way.

These rules are in place so that you can get the quickest and best support from #rubyonrails.

Rule #0: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us.

  1. Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
  2. If you've tried Googling, explain what terms you've tried to use so people can better help you.