Ruby Code

FacebookTwitter
Gems (lib)

http://ruby-doc.org/docs/ProgrammingRuby/html/tut_threads.html

Programming Ruby: The Pragmatic Programmer's Guide

Ruby gives you two basic ways to organize your program so that you can run different parts of it ``at the same time.'' You can split up cooperating tasks within the program, using multiple threads, or you can split up tasks between different programs, using multiple processes. Let's look at each in turn. Multithreading Often the simplest way to do two things at once is by using Ruby threads .
If you were a Unix shell fan, I bed that the “grep” command would be in your top-used list. But as for the Ruby programming, are you still prefer “grep” to the other methods come with the “Enumerable” module? Do you know in most of the situation, using “grep” is more handy and powerful than the commonly used “map” or “select” methods?

Grep in Ruby - A powerful Enumerable method

http://zigzag.github.com/2010/03/31/grep-in-ruby----a-powerful-enumerable-method.html
So yesterday we saw how to setup and run ruby scripts as executables from the command line. While this is pretty rad, it definitely has its limitations. For one, it’s not very portable and secondly it just isn’t very flexible or powerful. If we stuck with this approach we’d need to write our own semantic versioning, we’d have to setup a way to make sure that all of our required 3rd party gems get installed properly… really it’ll just be a big mess if we try to hand-roll it.

How To Write a Command Line Ruby Gem - Rob Dodson talks internets

http://robdodson.me/blog/2012/06/14/how-to-write-a-command-line-ruby-gem
Rake is a tool for controlling builds. In this part of the Rake tutorial, we see how to organize the Rake actions to apply to many similar tasks. In the RakeTutorialIntroduction, we talked about the basics of specifying dependencies and associating actions to build the files.

Rake Tutorial -- Handling Common Actions - { |one, step, back| }

http://onestepback.org/index.cgi/Tech/Rake/Tutorial/RakeTutorialRules.red

An Intro to Web Scraping | The Bastards Book of Ruby

For journalists and researchers, being able to web-scrape is perhaps one of the most compelling reasons to learn programming. Agencies and organizations don't always release their information in nicely-formatted databases. Learning to web scrape allows you to gather, in an automated fashion, freely available data in virtually any kind of online format. It's also one of the best ways to practice programming because the end goal is clear: either you have the data or you don't. And there's little harm to be done, provided your program scrapes at a reasonable rate. This chapter introduces the strategy of web scraping with a very non-technical overview of how websites work. http://ruby.bastardsbook.com/chapters/web-scraping/
http://www.igvita.com/2007/02/04/ruby-screen-scraper-in-60-seconds/ By Ilya Grigorik on February 04, 2007 I often find myself trying to automate content extraction from a saved HTML file or a remote server. I've tried a number of approaches over the years, but the dynamic duo of Hpricot and Firebug blew me away - this is by far the fastest way to get what you want without compromising flexibility. Hpricot is an extremely powerful ruby-based HTML parser, and Firebug is arguably the best on-the-fly development add-on for Firefox. Now, I said it will take you about 60 seconds.

Ruby Screen-Scraper in 60 Seconds

Ruby Programming/Syntax/Method Calls

A method in Ruby is a set of expressions that returns a value. With methods, one can organize their code into subroutines that can be easily invoked from other areas of their program. Other languages sometimes refer to this as a function . A method may be defined as a part of a class or separately. [ edit ] Method Calls http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls#Method_Definitions

Installing Ruby 1.9.3 on Ubuntu 12.04 Precise Pengolin (without RVM) – Shizzle

Installing Ruby 1.9.3 on Ubuntu 12.04 Precise Pengolin (without RVM) 02 May, 2012 The new Ubuntu release has just rolled around and with it a slew of new packages. Personally, I'm tracking the development of Ruby quite closely but the default Ruby on Ubuntu ist still the 1.8 series which I can't recommend. Ruby 1.9 has some performance improvements and 1.9.3 in particular a lot of them compared to 1.9.2. http://lenni.info/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/
http://pragashblog.blogspot.com/2012/05/setting-up-rvm-ruby-and-rails-on-ubuntu.html Ruby Version Manager which is known as RVM generally is a best software out there to manage multiple Ruby versions on a single PC. I myself have installed RVM a few times in different machines. But, whenever I needed to install RVM I had to visit a few sites that list all the necessary steps to set it up with Ruby, Rails.

Setting up RVM, Ruby and Rails on Ubuntu 12.04 | Pragash

http://heatware.net/ruby-rails/how-to-ssh-to-server-ruby-part-i/ Posted by sood on Thursday, January 20th, 2011 in Programming - Ruby/Rails Welcome to Part I of how to SSH to a Linux, Windows, etc. server using Ruby. This post will give you a complete code example to get you up and running right away!

How to SSH to a server using Ruby – Part I

How to SSH to a server using Ruby – Part II

Posted by sood on Thursday, January 20th, 2011 in Programming - Ruby/Rails Welcome to Part II of how to SSH to a server using Ruby. In Part I of this article, we gave you a simple example of how to SSH to a server and run a command. The hostname, username, password, and the command to execute were hardcoded in the example. In this article, we will expand on the first example by allowing you to specify the server connection information and the command to execute as command-line parameters. This will allow you to use the same script to connect to a variety of servers and execute any command without modifying the script over and over.

Net::SSH Manual :: Chapter 2: Starting a Session

Before you can do anything with Net::SSH, you need to require the net/ssh module: Requiring Net::SSH [ruby] Once you have required the net/ssh module, you can begin an SSH session by calling Net::SSH.start .

Net::SSH Manual :: Chapter 3: Channels

3.1. What are Channels? The SSH protocol requires that requests for services on a remote machine be made over channels . A single SSH connection may contain multiple channels, all run simultaneously over that connection. Each channel, in turn, represents the processing of a single service.
This tutorial will walk you through the basics of setting up and using Capistrano. It will not introduce you to the deployment system that is bundled with Capistrano, but will instead focus on the more general areas of executing Capistrano and writing your own recipes. It will be primarily of interest to those wanting to use Capistrano in non-deployment domains, and to those who just wish to become more familiar with Capistrano itself. Installation

2.x Getting Started · capistrano/capistrano Wiki

by Johan Lundahl - Dynamic languages , Tips & Tricks New to Capistrano? Read my previous and more introductory blog post on Capistrano - Remote builds with Capistrano . Are you using Capistrano and are confused why the user environment, the PATH for example, is different from when you log on to your server via SSH? Perhaps you have failed to use RVM or other user specific applications when running your Capistrano scripts?

Capistrano and Net:SSH with login shell