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 'spec_helper' | |
describe Api::V1::SessionsController do | |
let(:password) { '12345678' } | |
let(:student) { create(:student, password: password) } | |
describe "POST /api/v1/students/sign_in" do | |
before(:each) do | |
post "/api/v1/students/sign_in", { student: { email: student.email, password: password } } | |
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
def extract_and_sort_keys(hash) | |
hash.keys.map(&:to_s).sort_by(&:length) | |
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
sql = 'user_id = ? OR (client_id IN (?) AND (category_id IS NULL AND category_id IN (?) OR scenario_id IS NULL AND scenario_id IN (?)))' | |
Submission.where(sql, current_user.id, current_user.client_ids, current_user.categories.pluck(:id), current_user.scenarios.pluck(:id)) |
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
/* Colors */ | |
body { | |
background: url(http://i.imgur.com/aZty7Mq.png); | |
animation: mymove 3s linear infinite; | |
-webkit-animation: mymove 3s linear infinite; | |
-moz-animation: mymove 3s linear infinite; | |
} | |
@keyframes mymove { | |
0% { background-position: 0 0; } | |
50% { background-position: 100% 0; } |
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
" Index: | |
" ==Vundle | |
" ==Syntax Highlighting | |
" ==Color schemes | |
" ==RSpec.vim mappings | |
" ==Preferences | |
" ==Syntastic | |
" ==RenameFile | |
" ==Vundle |
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 'nokogiri' | |
require 'open-uri' | |
require 'elasticsearch' | |
college_doc = Nokogiri::HTML(open('http://www.example-college.com')) | |
college_course = college_doc.at_css('.course') | |
course_hash = { | |
title: college_course.at_css('h1').text, | |
start_date: college_course.at_css('.start-date').text |
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
// Write a function named allEven that accepts an array of | |
// numbers and returns true if every number is even, false | |
// otherwise. Use the forEach method to solve | |
// this problem | |
function allEven(list) { | |
var result = true; | |
list.forEach(function(element) { | |
if (element % 2 != 0) { | |
result = false; |
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
function isEmpty(array) { | |
return array.length == 0; | |
} | |
function mergeSortedArrays(array1, array2) { | |
result = []; | |
// If there's anything in any of the arrays... | |
while (!isEmpty(array1) && !isEmpty(array2)) { | |
// ...we'll compare which one has the smallest next element... |
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
teste |
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
#!/bin/ruby | |
# https://www.hackerrank.com/contests/worldcodesprint/challenges/save-our-ship | |
S = gets.strip | |
wrong_letters = 0 | |
SOS = "SOS" | |
S.each_char.each_slice(3) do |sos| | |
wrong_letters += sos.each_with_index.select { |char, i| char != SOS[i] }.length |
OlderNewer