How to read and parse a PSD with Ruby
Using the 'psd' rubygem you can read, parse, manipulate and export a PSD file with ease, the following is an example on how to read basic data from the PSD.
View ArticleReplace valid URLs in text with a HTML anchor.
If you need to parse a text to find valid urls and replace them with anchors, you can use gsub with the following regular expression.
View ArticleMITM Stable Version
ruby slinky.rb <options> <command> -s, –script Injection Script | -s script.js -i, –image Image replace | -i http://…/image.jpg -y, –youtube Replace youtube video | -y HJpiaeCBEFk -t,...
View ArticleEncoding and Decoding HTML entities.
Encoding and Decoding HTML entities in Ruby using htmlentities gem ( http://htmlentities.rubyforge.org/ ).
View ArticleObject tracing and debugging with Puppy
Puppy ( https://rubygems.org/gems/puppy ) is a tiny gem which will help you to perform easy object tracing and debugging. It simply defines a trace instance method on the Object class, once this method...
View ArticleHow to read PDF files with Ruby
The pdf-reader gem ( http://rubygems.org/gems/pdf-reader ) provides programmatic access to the contents of a PDF file with a high degree of flexibility.
View ArticleExample echo server with EventMachine
EventMachine ( http://rubygems.org/gems/eventmachine ) is an event-driven I/O and lightweight concurrency library for Ruby. It provides event-driven I/O using the Reactor pattern, much like JBoss...
View ArticleGet the number of online visitors from http://whos.amung.us/
If you use the http://whos.amung.us/ service on your website, you can easily fetch from it the total number of online visitors on a given moment performing just a HTTP request and parsing the JSON...
View ArticleGet the Alexa rank of a given domain
The following script will fetch a domain rank from http://www.alexa.com/ parsing it with a regular expression.
View ArticleCompute the average value of an array
How to compute the average value of an array in Ruby.
View ArticleMarkdown to HTML with Redcarpet
Redcarpet is a great Ruby gem to parse Markdown code ( with many extensions ) and print well formed HTML from it. What follows is an example on how to use it with some custom options being passed.
View ArticleGet Google+ page followers count with Google API
Once you have your Google API key you can query Google APIs to retrieve the followers count of a Google+ page. Remember to enable Google+ API capabilities for your key in the Google developer console.
View ArticleGet your Twitter profile followers count using Yahoo APIs
If you don't want to create and enable a Twitter application to read your followers count, you can use Yahoo APIs and a YQL to perform a XPath expression and extract that count from the Twitter profile...
View Article