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:
#add 'node_modules' to .gitignore file | |
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin master |
#!/bin/bash | |
sudo apt-get update | |
# To make sure we have everything necessary for Webpacker support in Rails, we're first going to start by adding the Node.js and Yarn repositories to our system before installing them. | |
sudo apt-get install curl | |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update |
{ | |
"AP":[ | |
"Adilabad", | |
"Anantapur", | |
"Chittoor", | |
"Kakinada", | |
"Guntur", | |
"Hyderabad", | |
"Karimnagar", | |
"Khammam", |
Save below code to `bson.rb` file within `config/initializers` directory and restart the server | |
module BSON | |
class ObjectId | |
def as_json(*args) | |
to_s | |
end | |
end | |
end |
# RSpec allows us to test private methods of a model. | |
for example, | |
class User | |
def is_active? | |
true | |
end | |
private :is_active? | |
end |
# 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'.