Create the partition:
sgdisk --zap-all /dev/sda
cgdisk /dev/sda
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt
Edit the mirror list to bring the preferred mirror to the top:
# nil? can be used on any Ruby object. It returns true only if the object is nil. | |
nil.nil? # => true | |
[].nil? # => false | |
{}.nil? # => false | |
"".nil? # => false | |
" ".nil? # => false | |
true.nil? # => false | |
# empty? can be used on some Ruby objects including Arrays, Hashes and Strings. It returns true only if the object's length is zero. | |
nil.empty? # NoMethodError: undefined method `empty?' for nil:NilClass |
require 'webrick' | |
Port = 3000 | |
Directory = Dir::pwd | |
WEBrick::HTTPServer.new( | |
Port: Port, | |
DocumentRoot: Directory | |
).start |
Create the partition:
sgdisk --zap-all /dev/sda
cgdisk /dev/sda
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt
Edit the mirror list to bring the preferred mirror to the top:
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
A Hash is a collection of key-value pairs. To add, fetch, modify, and delete a value from a Hash, you refer to it with a unique key.
While an Array is indexed by Integers only, a Hash is keyed by any object -- Strings, Integers, etc.
In other programming languages, a Hash might be known as an 'associative array', 'dictionary', or 'HashMap'.
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
<h1><center>Rishi Pithadiya</center></h1> |