background preloader

Rubular: a Ruby regular expression editor and tester

Rubular: a Ruby regular expression editor and tester

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. :onChange issue (Page 1) - XHTML/CSS/JavaScript Yay--it worked! Thank you Ryan! It might be because I have RESTful routes, but I had to delete the foo bit entirely, leaving this: For those wrestling with this kind of thing too, here's what how it works (or at least how this noob made it work): The long line Ryan just helped me write is in a partial _select_advertformat.rhtml that is rendered from adverts/new.rhtml. It's the only bit of necessary code in that partial.

Course Info For questions on course lectures, homework, tools, or materials for this course, post in the course discussion forum. Have general questions about edX? You can find lots of helpful information in the edX FAQ. Have a question about something specific? linear regression x Image InputX Upload an image from your computer: Enter a URL for an image: Regexp A Regexp holds a regular expression, used to match a pattern against strings. Regexps are created using the /.../ and %r{...} literals, and by the Regexp::new constructor. Regular expressions (regexps) are patterns which describe the contents of a string. They’re used for testing whether a string contains a given pattern, or extracting the portions that match. They are created with the /pat/ and %r{pat} literals or the constructor.

Ruby Regular Expressions A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings using a specialized syntax held in a pattern. A regular expression literal is a pattern between slashes or between arbitrary delimiters followed by %r as follows: Syntax: /pattern//pattern/im # option can be specified%r!

AJAX on Rails 2.1 Tutorial Advertisements Ajax stands for Asynchronous JavaScript and XML. Ajax is not a single technology; it is a suite of several technologies. Ajax incorporates the following: XHTML for the markup of web pagesCSS for the stylingDynamic display and interaction using the DOMData manipulation and interchange using XMLData retrieval using XMLHttpRequestJavaScript as the glue that meshes all this together Starting Ruby on Rails: What I Wish I Knew Ruby on Rails is an elegant, compact and fun way to build web applications. Unfortunately, many gotchas await the new programmer. Now that I have a few rails projects under my belt, here’s my shot at sparing you the suffering I experienced when first getting started.

Polynomial Regression Data Fit Note: In this article, footnotes are marked with a light bulb over which one hovers. Background For a given data set of x,y pairs, a polynomial regression of this kind can be generated: In which represent coefficients created by a mathematical procedure described in detail here. Regular Expressions - A Gentle User Guide and Tutorial A Regular Expression is the term used to describe a codified method of searching invented, or defined, by the American mathematician Stephen Kleene. The syntax (language format) described on this page is compliant with extended regular expressions (EREs) defined in IEEE POSIX 1003.2 (Section 2.8). EREs are now commonly supported by Apache, PERL, PHP4, Javascript 1.3+, MS Visual Studio, most visual editors, vi, emac, the GNU family of tools (including grep, awk and sed) as well as many others. Extended Regular Expressions (EREs) will support Basic Regular Expressions (BREs are essentially a subset of EREs).

74 Quality Ruby on Rails Resources and Tutorials Learning Rails from scratch can be a pain. But don't fret, this guide provides the best Rails resources the Web has to offer. Ruby on Rails is quickly becoming one of the most popular modern programming language framework combinations. Ruby 1.9 Encodings: A Primer and the Solution for Rails May 5th, 2010 UPDATE: The DataObjects drivers, which are used in DataMapper, are now updated to honor default_internal. Let’s keep this moving. Since Ruby 1.9 announced support for encodings, there has been a flurry of activity to make existing libraries encoding aware, and a tornado of confusion as users of Ruby and Rails have tried to make sense of it. In this post, I will lay out the most common problems people have had, and what we can do as a community to put these issues to bed in time for Ruby 1.9.2 final. A Quick Tour

Related:  Scraping - Automatisation