background preloader

Ruby User's Guide

Ruby User's Guide
Related:  PL

bbatsov/ruby-style-guide A MiniTest::Spec Tutorial: Elegant Spec-Style Testing That Comes With Ruby Despite RSpec's awesomeness, Test::Unit remains the most popular Ruby testing tool out there outside of Rails apps. I've recently been code walking through a lot of Ruby libraries for my Ruby Reloaded course and the typical arrangement is Test::Unit, sometimes coupled with Shoulda or Contest for some extra syntactic sweetness. Part of the reason for Test::Unit's enduring popularity is its presence in the Ruby standard library but, also, its general 'lightness' and speed. Enter MiniTest With Ruby 1.9, however, MiniTest entered the standard library. require 'test/unit' still works in Ruby 1.9 but it's provided through a compatibility layer on top of MiniTest, so if you're using require 'test/unit' in Ruby 1.9, you're really using MiniTest under the hood. Note: Ruby 1.8 users can run gem install minitest to get MiniTest too but it's not part of the standard library there. What Does MiniTest::Spec Look Like? Let's start with a ridiculously simplistic Test::Unit style test: Give It A Try

The Unofficial Ruby Usage Guide You may be interested to know that this document was originally written for internal use in the Operations department at Google. At the time, I was campaigning for the right to use Ruby on internal projects and I felt that a style and usage guide would probably assist in the battle for the language's acceptance, as the officially sanctioned languages at the time already had one. If nothing else, we'd at least all end up writing code that was easier to maintain. Over the last few years, Ruby has struck a chord with programmers as an excellent tool for -- amongst other things -- system administration. With that as our perspective, this document will suggest some guidelines for writing Ruby code in such a way that a common stylistic vocabulary may emerge, thereby increasing the ease with which source code may be read and shared. If you have questions about this document, please address them to its author, Ian Macdonald. An Admonishment irb irb stands for Interactive Ruby. Similarly, "foo". ri #!

PHP coding standards - tech.tmw.co.uk Coding Standards and Best Programming Practices for PHP Contents Naming Conventions and Standards Code Indentation Generally you should use the Allman style ( of indenting code. <? This will differ slightly from the indentation style mainly used for Javascript (like K&R), but there are valid cases where the Allman style would cause syntactic differences in code execution (such as implied return values in Javascript because the semicolon is optional). <? Also, tabs should be used to indent code rather than spaces. Brace Usage If your if() or loop only contains one executable statement, the containing braces are optional, and should be omitted: <? The statement should still be indented as usual, and kept on a separate line for readability. Trailing Whitespace Avoid this if you can. Naming Conventions <? But the following are not: <? <? Code Commenting Below is an example: <? String Concatenation <? Good Programming Practices KISS Principles <? <? <? <? <? <? <?

Blog — All about Ruby programming. The Wonderful Tech Wizards of Oz Photo by David Jackmanson / Flickr The Information and Communication Technology sector is the fifth highest paying career group in Australia, with entry salaries starting at $88,000 and median salaries of $100,000. The growth of technology centers created by governmental planners and business networks, such as the Bentley Technology Park in Western Australia (adjacent to Curtin University of Technology), the Digital Harbour at Docklands in Melbourne, and the Macquarie Park in Sydney (including the Research Park and Macquarie University), combined with respected universities and the roll-out of the National Broadband Network, all demonstrate the IT successes of the Aussies! School ‘Em at Home! While the IT students of many countries travel abroad to further their education, Australians have many choices that are keeping their kids on native soil. And Hook ‘Em All Up!

Rosetta Code gui2py - Simple and powerful GUI framework for agile development InformacionGeneral - GuiaInstalacion (Español) gui2py is a GUI framework for building cross-platform "visual" desktop applications on Windows, Mac OS X, and Linux, using the Python language and the wxPython toolkit. Its objetive is to evolve PythonCard with web2py's phylosophy and facilities with the following goals: KISS compact structure: easy to learn, complete and powerful GUI Framework for Rapid Application Development Visual Tools: designer, inspector and property editor, embeddables into IDEs (see rad2py screenshot) HTML/Javascript-like capabilities (i.e. events, layout): reusing and/or adapting gluon (web2py framework) + automatic flow mechanism Features Currently, gui2py supports the following components: Visual Tools For quick Point-and-Click visual design of user interfaces, gui2py includes: a designer, a toolbox, an inspection tool and a property editor: Screenshots For more screenshots, browse the screenshots folder in the repo. Compatibility Notes: Installation News

21 Ruby Tricks You Should Be Using In Your Own Code Writing for Ruby Inside, I get to see a lot of Ruby code. Most is good, but sometimes we forget some of Ruby's shortcuts and tricks and reinvent the wheel instead. In this post I present 21 different Ruby "tricks," from those that most experienced developers use every day to the more obscure. Whatever your level, a refresh may help you the next time you encounter certain coding scenarios. Note to beginners: If you're still learning Ruby, check out my Beginning Ruby book. 2009 Update: This post was written in early 2008 and looking back on it, there are a couple of tricks that I wouldn't recommend anymore - or to which extra warnings need to be added. 1 - Extract regular expression matches quickly A typical way to extract data from text using a regular expression is to use the match method. email = "Fred Bloggs <fred@bloggs.com>"email.match(/<(.*?) Ultimately, using the String#[] approach is cleaner though it might seem more "magic" to you. x = 'this is a test' x[/[aeiou].+? puts x == 10 ?

Related: