Welcome To Snipplr
Everyone's Recent Snippets Tagged ruby
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Creating a object that doesn't have any methods in Ruby (regular objects inherit methods from Object class), useful for Proxies that use method missing (http://onestepback.org/index.cgi/Tech/Ruby/BlankSlate.rdoc).
1
1124
posted 15 years ago by narkisr
Can be used to generate a random code for an online voucher. You just need to set VOUCHER_CODE_LENGTH in your environment.rb or similar.
1
843
posted 15 years ago by jordanbrock
An example of redo statement in Ruby, redo makes an iteration step repeat itself again (http://www.rubyrailways.com/rubys-most-underused-keyword/).
1
792
posted 15 years ago by narkisr
I had a directory tree with around 4000 pdf files and I needed a page count - so I semi-rolled this. I swiped the counter code from the gem README:
http://github.com/yob/pdf-reader/tree/master
It could be more contained - as is I run it from irb:...
1
1099
posted 15 years ago by inkdeep
Rake task - Copies files from one directory to another in a batch of 50 files, giving 15 seconds break between each batch.
1
891
posted 16 years ago by cnicolaou
I needed a quick way to unescape a URL Encoded string. I found 2 chill ways
2
776
posted 16 years ago by chrisaiv
Simple Outlook automation, the idea is to use this in cygwin to send files without opening the outlook UI, to use it place the code under /bin folder and make it executable with chmod +x.
2
832
posted 16 years ago by narkisr
If you get "JPEG marker not found!" error when you try to open an image file you must read it in binary mode.
1
720
posted 16 years ago by PixelMin