| Snippet ID |
Title |
|
 |
| Packages Of Snippets | | 1 | bin2hex | Xu Jingtao |
| a small untility that can convert a binary file to assembly or c format hexadecimal string. |
| 4 | rubypkg | Jayen Chandra |
| rubypkg |
| 5 | File Splitter and Joiner | Saajan N |
File Splitter: Split a big file into a number of smaller files
File Joiner: Join all your "piece" files into a single file again |
| 9 | cms for real estate | M Ilyas |
| content management system for real estate |
| 51 | RubySnips | Larry Kite |
| Snippets of Ruby |
| 52 | virtapay | Cici Wirachmat |
| Business Website using Ruby on Rails |
| Snippets |
| 7 | MS Word document manipulation | Tom Copeland |
Some snippets written by James Toomey in this ruby-talk posting:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/60004
|
| 39 | BatchFileEditor | James McCarthy |
Great IO example,
(IMHO)
Replaces simple characters with other ones in files of type specified
Meant for *nix.
My first working Ruby code.
|
| 58 | Filenames to 7-bit ASCII | Kaspar Schiess |
Convert all directories and files under a given path to contain only 7-bit ascii.
Transliteration is done trough a easy to expand lookup table.
To commit things, replace FileUtils::DryRun with FileUtils |
| 60 | ruby which | Bruno Carnazzi |
| which command ruby equivalent |
| 77 | config.rb | Balwinder S Dheeman |
| Class to read/write config files with [sections], keywords = value pairs. |
| 84 | rubyforge.net | Ruby Dos Zapatas |
This is what I use Spirit and RubyRelease with.
It does it all! |
| 85 | filesystem recursive deletion | Gary Shea |
A simple script for recursive deletion of a directory. Deletes everything. Originally written to use for a 'clean' target in Rake. The code that actually does the deletion is commented out. Try it. If you decide you trust it, remove the 'puts' and uncomment the File.delete.
Enjoy! |
| 86 | long argument list parser | ruy jauregui |
This snippet manages a long list of arguments given to a ruby program. It recognizes 2 flags, "-l" which calls a "ls" command to be run and gives the result as arguments to the program and "-f filename" which reads the lines in "filename" and gives the result as arguments. If no flags are given it takes the standard ARGV array.
The resulting argument list is given in an array called @lis.
|
| 87 | File Recursive | Felix Sun |
| To get every file in the given folder include subfolder. |
| 96 | onclick en javascript | christopher espinoza |
| necesito crear un onclick destro de un arbol creado en javascript, el cual hereda atributos de un archivo *.js |
| 105 | File Splitter | Saajan N |
File Splitter: Split a file into a number of smaller pieces
|
| 106 | File Joiner | Saajan N |
| File Joiner: Join all your "piece" files into a single file again |
| 110 | Create package for release on rubyforge | Soemirno Kartosoewito |
| Creates packages from a tag in the sourcetree. |
| 128 | FileUtils.cp_r wrapper for patching a tree of files | Albert Davidson Chou |
| A convenience script wrapping FileUtils.cp_r's ability to copy all contents of the source directory instead of the directory itself. I needed to patch a set of PHP files with a newer subset of those files. The :preserve argument is set to TRUE in the FileUtils.cp_r call so the modification dates of all the files will be usable as a version identifier (otherwise, the modification date becomes "today", which only indicates the date the patch was performed, rather than what version the patch applied was). |
| 129 | Split a file at delimiting lines | Albert Davidson Chou |
This script will split a file at lines identified by a regular expression. The output files will be named using the original file's name with ".1", ".2", etc. appended to the name of each consecutive output file.
I wrote this script because I needed to break up a text file of MySQL table contents dumped out by phpMyAdmin into one big CSV-style file. The delimiting line in this case was the column headings declaration for each table, which started with "ID;".
The command line for this situation was (on OS X):
split_at_line input_file.csv ^\"ID\"
where I had to escape the " characters so they would not be stripped away by bash before it passed the argument to the script.
The script implicitly assumes that its input file is text, not binary, as the format is not specified when opening the files. |
| 153 | clean | ruy jauregui |
| remove 0 size files from a directory |
| 154 | squeeze | ruy jauregui |
This function reads the contents of a file, or a list of files, and prints a non-redundant version; the same files with repeated lines removed.
|
| 499 | HTML5 OfflineWebApp | K Chandrasekhar Omkar |
| Imagine a website being used by billions, at once. All the requests, responses make huge amounts of data to flow, contributing network congestion. Hence, it would be ridiculous & costly to send a request to the server for a very minor operation. For example, take an online ticket booking server, which is used for planning trips, booking all tickets. Suppose there is a phone-number, and email ID field that is required at the time of booking tickets, and you forgot to fill it before submitting. It then becomes the server's responsibility to ensure valid data is being processed, apart from various other business transactions. For such a busy server, validating input data would surely become an overhead, and has considerable impact on the performance. Hence, it should be ensured before submitting, that all inputs are fed properly. So, JavaScript comes into the picture here. This script is executed suitably, at the client end to ensure that all data adheres to specifications. Script then submits data after thorough validation. Doesn't it reduce atleast half of the requests being made to the server? Obviously, the amount of traffic in the network gets reduced drastically. |
| 256 | File.each_line (class method for File) | Patrik Wenger |
Just a quick way for iterating over each line of a given file path. Return value is the number of lines.
Example:
File.each_line("file.txt") do |line|
puts "line = #{line}"
end |
| 287 | Core Class Extensions | James Schneider |
| All the stuff I've wanted and had to add to Ruby's infrastructure that I've remembered to save. |
| 561 | GenLib | Bob Hostern |
| A small Ruby file generating class. You must include a file called "makefile.opgenc" in the directory of the snippet in order to work out of the box. |