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
$ git clone https://github.com/roa-2015/sinatra-skeleton-mvc-challenge.git | |
$ rm -rf .git | |
Once have done the above you can copy the content of the top folder into other folders for use. |
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 "httparty" | |
class BookParser | |
attr_accessor :data | |
def initialize(data) | |
@data = HTTParty.get(data).parsed_response | |
load_books | |
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
$(document).ready(function() { | |
$(document).on('click', '.voted', function(e){ | |
e.preventDefault(); | |
}) | |
$(document).on('click', '.vote-button', function (e){ | |
e.preventDefault(); | |
// console.log($this) | |
var $link = $(this); | |
var url = $link.attr('href'); | |
$.ajax ({ |
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 "GET /users" do | |
before do | |
5.times {FactoryGirl.create(:user)} | |
get "/api/v1/users/" | |
end | |
it "shoudl return all the users as json" do | |
expect(last_response.body).to eq(User.all.to_json) | |
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
.ui-widget-header,.ui-state-default, ui-button{ | |
background:#b9cd6d; | |
border: 1px solid #b9cd6d; | |
color: #FFFFFF; | |
font-weight: bold; | |
} |
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
$(document).ready(function() { | |
//run the code | |
// console.log("this is loading") | |
$(document).keyup(function(e) { | |
// console.log(e) | |
updatePlayerPosition(e.keyCode) | |
}); | |
}); |
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
$('img').mouseenter(function () { | |
$(this).css({border: '0 solid #f37736'}).animate({ | |
borderWidth: 4 | |
}, 500); | |
}).mouseleave(function () { | |
$(this).animate({ | |
borderWidth: 0 | |
}, 500).hide(); | |
}); |
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
https://devcenter.heroku.com/articles/getting-started-with-rails4#local-workstation-setup | |
https://devcenter.heroku.com/articles/getting-started-with-ruby#introduction | |
heroku login | |
- To run on Heroku your app must be configured to use the Postgres database, have all dependencies declared in your Gemfile, and have the rails_12factor gem in the production group of your Gemfile | |
gem 'rails_12factor', group: :production | |
gem 'pg' - make sure have |
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
save_and_open_page | |
puts page.body |
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
Click on an image in a link with Capybara | |
find(:xpath, "//a/img[@alt='Edit']/..").click |