Creating a list of A-Z and 0-9 is very simple in Ruby. You may need to do this for numerous reasons but the writing of this tip came about when needing to create a memorable word interface, like that of banks. Continue reading →
If you need to split a string based on uppercase values, for example “ComputeAsAService” in order to provide a readable string “Compute As A Service” you can do so simply by using regular expressions, in particular you can use the lookahead operator “?=”.
1
2
3
| str = "ComputeAsAService"
parts = str.split(/(?=[A-Z])/)
>> ["Compute", "As", "A", "Service"] |
Continue reading →
When I first started writing in ruby I found myself needing to know the ruby method equivalents to specific PHP functions. These methods are widely used by myself for debugging and day to day checking of data types.
PHP’s die(‘message’) becomes
PHP’s get_class_methods() becomes
PHP’s in_array() becomes
Continue reading →