This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "switch_user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in 1..100 do | |
if i % 3 == 0 | |
puts 'Anonymous' | |
elsif i % 5 == 0 | |
puts 'Llama' | |
end | |
if (i % 3 == 0 && i % 5 == 0) | |
puts 'AnonymousLlama' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oauth' | |
require 'oauth2' | |
class ContactImporter | |
def initialize(importer) | |
@importer = importer | |
end | |
def authorize_url | |
case @importer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "compass/css3"; | |
.main_content { | |
@include flow-into(target); | |
} | |
.regions div { | |
@include flow-from(target); | |
width: 150px; | |
height: 190px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "compass/css3/filter"; | |
.filtered { | |
@include filter(grayscale(50%)); | |
@include filter(blur(10px)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# is_printed? la 1 cai method, dau hoi la 1 kieu naming convention. Method return true or false se co dau ? | |
# con dau ! la phu dinh | |
while !document.is_printed? | |
document.print_next_page | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First | |
class Example | |
def hello | |
puts 'hello' | |
end | |
def vinh | |
puts 'vinh' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'nokogiri' | |
require 'csv' | |
# Store URL to be scraped | |
url = "https://deliveroo.co.uk/restaurants/london/maida-vale?postcode=W92DE&time=1800&day=today" | |
# Parse the page with Nokogiri | |
page = Nokogiri::HTML(open(url)) | |
# Display output onto the screen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
context "GET index" do | |
#context "POST create" do | |
#context "GET show" do | |
#context "PATCH update" do (or PUT update) | |
#context "DELETE destroy" do | |
#context "GET new" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in spec/support/omniauth_macros.rb | |
module OmniauthMacros | |
def mock_auth_hash | |
# The mock_auth configuration allows you to set per-provider (or default) | |
# authentication hashes to return during integration testing. | |
OmniAuth.config.mock_auth[:twitter] = { | |
'provider' => 'twitter', | |
'uid' => '123545', | |
'user_info' => { | |
'name' => 'mockuser', |