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
    
  
  
    
  | Originally From: http://www.peo.gov.au/multimedia/library/pages/0148.html | |
| DDDDDDDDDNNNNNNNNNNNNNNNDDDDDDDDDDDDD8OOZ7I$O8DD$I==~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| NNNNNNNNNNNNNNNMNMMNMNMNNNDNDDDD7I$O8OZZ8O7$D8DD$,?::~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| NNNNDNNMMNMMMMMMMMMMMMMMMMNNNO7$DDODOO88I??ZI+IDOD88DZ+~~~::~::::::~:~~~~~~~:~~~ | |
| NNNNMMMMMMMMMMMMMMMMMMMMMMN8ZOZD8O$$OZZ$ZZZ$ZZZZ$Z$+888O?:~~~::::::::~~~~:::~~~~ | |
| DNNNMMNMNMMMMMMMMMMMMMMM8ZODN88DDD8DNDDD8D8DD88DDDN$7II~77,,:::~:::::::~~~~~~~~~ | |
| NNNNMMNMMMMMMMMMMMMMMNDZZZDDNDNDNN8NNDDD8DDDNDDNNDNZ8DO7I$==I+,::::::::~~~::~~~~ | |
| NNNNMMMMMMMMMMMMMMMMN8I7O88D88NDN8$88Z$O888O8NDDDNND8DDZ$7?++???:::~:::::::::::: | |
| NNNNMMMMMMMMMMMMMMM8O$$Z8DNN8D8OZZO88DDDDDDD8DDDDNND8DDZZ77I?==+:~=::::::::::::~ | 
  
    
      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 onsubmit="return makeFieldsTheSameValue();"> | |
| <!-- | |
| It's important that your input fields have unique ID attributes, | |
| otherwise we won't be able to reference them easily via JavaScript. | |
| --> | |
| <label for="field_one">Field One</label> | |
| <input type="text" name="field_one" value="" id="field_one"> | |
| <label for="field_two">Field Two</label> | 
  
    
      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
    
  
  
    
  | class Article < ActiveRecord::Base | |
| # Has attributes: :title, :body, :active | |
| attr_protected :active | |
| end | |
| class Image < ActiveRecord::Base | |
| # Has attributes: :title, :filename, :active | |
| attr_accessible :title | 
  
    
      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
    
  
  
    
  | module ResourcefulRequestHelper | |
| # Iterates through each route defined for the current controller, yielding | |
| # each one to allow the same set of assertions / expectations to be tested. | |
| # | |
| # Usage: | |
| # ====== | |
| # describe UsersController do | |
| # let(:user) { double('user') } | |
| # | 
  
    
      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
    
  
  
    
  | [server] administrator:~$ nc -zvw 1 207.97.227.239 22 | |
| github.com [207.97.227.239] 22 (ssh) : No route to host | |
| [server] administrator:~$ nc -zvw 1 207.97.227.239 80 | |
| github.com [207.97.227.239] 80 (www) open | 
  
    
      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
    
  
  
    
  | class FancyMiddleware | |
| def initialize(app) | |
| @app = app | |
| @excluded_paths = [] | |
| end | |
| def call(env) | |
| # env variable may be wrong here | |
| if @excluded_paths.include(env["REQUEST_PATH"]) | |
| # do magic | 
  
    
      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
    
  
  
    
  | class User | |
| include Mongoid::Document | |
| field :email | |
| validates_format_of :email, :with => /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i, :message => "is not a valid email adress." | |
| 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
    
  
  
    
  | class FoosController < AbstractController::Base | |
| def update | |
| @foo = Foo.find(params[:id]) | |
| # If our changed object saves... | |
| if @foo.update_attributes(params[:attributes]) | |
| # Now, we check for changes. In some situations, we might | |
| # use @foo.notify_changed? but given that update_attributes | |
| # clobbers the dirty state of your instance, we need to | 
  
    
      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
    
  
  
    
  | def update | |
| if @baby.update_attributes(params[:baby]) | |
| if params[:notify] == true | |
| flash[:notice] = "Done" | |
| else | |
| redirect_to(root_url(:host => with_subdomain(@baby.subdomain)), :notice => 'Your baby was successfully updated and everyone has been told the good news.') | |
| end | |
| else | |
| render :action => "edit" | |
| 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
    
  
  
    
  | # Given a big (~25MB) text file, I want to extract | |
| # and process lines that are prefixed with a certain | |
| # string. In the actual case, known_prefixes is | |
| # approximately 50 elements long with potential for growth | |
| known_prefixes = %w(aa ab ax fy fx) | |
| regex = "^#{known_prefixes.join("|")} " | |
| IO.foreach(big_ass_text_file).each |row| | |
| if row =~ regex |