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
describe 'API Request', type: :request do | |
let!(:request) do | |
-> { rails_respond_without_detailed_exceptions { get '/bad/path' } } | |
end | |
context 'first context, perhaps when a user is signed in' do | |
before { request.call } | |
it 'returns http not found (404)' do | |
expect(response).to have_http_status(:not_found) |
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 'benchmark/ips' | |
class PangramArraySubtraction | |
def self.pangram?(phrase) | |
([*'a'..'z'] - phrase.downcase.chars).empty? | |
end | |
end | |
class PangramArrayAllInclude | |
def self.pangram?(phrase) |
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
Rails.application.routes.draw do | |
concern :reviewable do | |
resources :reviews, only: [:new, :create, :index] | |
end | |
resources :reviews, only: [:show, :delete, :edit, :update] | |
resources :artists, :albums, :songs, :lyrics, only: [], concerns: :reviewable | |
resources :artists 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
function isArray(obj) { | |
return (typeof obj !== "undefined" && obj !== null && obj.constructor === Array) | |
} | |
function areArrays() { | |
if (arguments.length === 0){ return null } | |
for (i = 0; i < arguments.length; i++) { | |
if (!isArray(arguments[i])) { return false } | |
} | |
return true |
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 isArray(obj) { | |
return (typeof obj !== "undefined" | |
&& obj !== null | |
&& obj.constructor === Array) | |
} | |
function areArrays() { | |
if (arguments.length === 0){ return null } | |
for (i = 0; i < arguments.length; i++) { | |
if (!isArray(arguments[i])) { return 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
# Split a horses create action into separate methods for success and failure. | |
def post_horses_success | |
if request.xhr? | |
content_type :json | |
as_html = erb :'/horses/_horse_list_item', layout: false, locals: { horse: @horse } | |
{ horse: @horse, as_html: as_html }.to_json | |
else | |
redirect "/horses/#{@horse.id}" | |
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
Tiffany - There is a Sinatra skeleton in the cohort repos, don't use JQuery CDN version 3. | |
Matt - Helpers directory needs to be directly under app | |
David - Status code of 200 will always send back string | |
Jordan - ES2015 has an arrow function | |
Erik - In JS you can pass an object literal as an argument to a function | |
Ali - You can store a partial as a variable convert to json and send it with json data | |
Jack - You can use modules instead of helper methods | |
Ian - Weirdness with params in authentication? | |
Brendan - .off in JQuery will remove event binding, not all JS versions support default arguments | |
Lisa - JQuery script needs to be added before your other JS |
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
<div class="mobile"> | |
<div class="dates mobile"> | |
May 17th | |
</div> | |
</div> | |
<div class="desktop"> | |
<div class="dates"> | |
May 17th | |
</div> |