Prints an inspected version of the argument AND returns the argument.
[1] pry(main)> name = p [["Hello"]]
by Caio Andrade Le Wagon Teacher and Klatchian Coffee Guzzler
This list is ultimately a reflection of my own experiences growing as a developer. It’s more suitable if your career goal is to be a Ruby developer with a heavy focus on Software Engineering and the Rails stack. It deepens what you're familiar with after finishing Le Wagon.
Build things. If you're practicing by yourself, find a problem you want to solve. Be it a page component you're interested in (a navbar that hides on a threshold) or an entire, but simple, app (a downscaled Evernote clone), it's important to have clear goals and to be able to see the results of your work.
# Generate and use an oauth2 bearer token for the Twitter API in Ruby | |
# | |
# For Application-Only authentication to the twitter API, a 'bearer token' | |
# is required to authenticate agains their endpoints for rate limiting | |
# purposes. | |
# | |
# This script generates a bearer token by posting to twitter and then it | |
# uses that token to poll their API. | |
# | |
# Note, the base 64 encoded consumer credentials for the bearer token needs |
require 'benchmark' | |
# Disable logging if in development/test mode | |
ActiveRecord::Base.logger = nil | |
model_name = Icd | |
N = 100 | |
Benchmark.bm(11) do |x| | |
x.report('ruby rand') { N.times { model_name.offset(rand(model_name.count)).first } } |