This file contains hidden or 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
| # example of using rush to access files on multiple servers (as one collection) | |
| nginx_confs = %w(www1 www2 www3).map { |n| Rush::Box.new(n)['/etc/nginx/nginx.conf'] } | |
| nginx_confs.search(/access_log/) |
This file contains hidden or 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
| %0 Journal Article | |
| %T Spectacular Giant Magnetoresistance Effects in the Polycrystalline Perovskite Pr0. 7Sr0. 05Ca0. 25MnO3-d | |
| %A Raveau, B | |
| %A Maignan, A | |
| %A Caignaert, V | |
| %J Journal of Solid State Chemistry | |
| %V 117 | |
| %N 2 | |
| %P 424-426 | |
| %D 1995 |
This file contains hidden or 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
| # app/helpers/application_helper.rb | |
| # Sets the page title and outputs a container if passed in. | |
| # ex. <%= title('Some Page', :h2) %> will return the following: | |
| # <h2>Some Page</h2> as well as setting the page title. | |
| def title(name, container = nil) | |
| @page_title = name | |
| content_tag(container, name) if container | |
| end |
This file contains hidden or 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
| h1. Things I Always Do | |
| * Initialize git repository | |
| * Move config/database.yml to config/database.yml.example | |
| * rm -f log/*.log | |
| * <code>find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;</code> | |
| * git add . && git commit -m 'Initial commit.' | |
| * Add top-level .gitignore | |
| * Write AppConfig | |
| * Install restful_authentication. |
This file contains hidden or 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
| <% form_tag session_path, :class => 'some_class' do %> | |
| <%= text_field_tag :openid_url, params[:openid_url] || params['openid.identity'], :class => 'another_class' %> | |
| <%= submit_tag 'Use OpenID', :class => 'button grey' %> | |
| <% end %> |
This file contains hidden or 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
| # Just in case you can't make up your mind. | |
| # Provide a string of choices separated by 'or'. | |
| # | |
| # p = Picker.new('tits or gtfo or OMFG') | |
| # p.choice # => 'tits' | |
| # p.choice # => 'OMFG' | |
| # | |
| # | |
| # The second argument can be a separator: | |
| # |
This file contains hidden or 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
| # Passenger (mod_rails) Apache2 config. | |
| <VirtualHost 1.2.3.4:80> | |
| ServerAdmin [email protected] | |
| ServerName www.example.com | |
| DocumentRoot /path/to/rails_root/public | |
| </VirtualHost> |
This file contains hidden or 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
| # Coin.flip # => 'heads' or 'tails' | |
| class Coin | |
| def self.flip | |
| %w{heads tails}.sort_by {rand}.first | |
| end | |
| end |
This file contains hidden or 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
| Flush DNS Cache | |
| OSX (10.5) | |
| ---------- | |
| dscacheutil -flushcache | |
| Windows | |
| ------- | |
| C:\>ipconfig /flushdns | |
This file contains hidden or 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
| # tree = Node.new | |
| # tree.branch.leaf.value = 'Hello World!' | |
| class Node < Hash | |
| attr_accessor :value | |
| def method_missing(key) | |
| self[key]==nil ? self[key]=Node.new : self[key] | |
| end | |
| end |
OlderNewer