How to be an idiot at coding part infinite + 1
Use range headers to ensure not downloading complete response, when only needing a small amount of bytes.
Posts tagged with "ruby"
Use range headers to ensure not downloading complete response, when only needing a small amount of bytes.
Unlike Javascript and PHP you don't call a function with one parameter - instead you can call to_json on the object you want to convert.
In Ruby you parse json by first including the json library provided with the language.
Reading from stdin in ruby is as easy as calling STDIN.read
In ruby you have lowlevel access to all the same methods that you do in C, but you also have some higher level sugar on top.
In Ruby there is no built-in support for parsing and writing xml, but my favourite tool for working with xml in ruby is nokogiri.
In ruby you read a file in two steps - first open the file, and then iterate over the contents.
Ruby has a global ARGV array which contains all arguments, but unlike C and PHP it does not contain the script name.