Skip to content

Instantly share code, notes, and snippets.

View libbyschuknight's full-sized avatar
🏡
Working remotely

Libby Schumacher-Knight libbyschuknight

🏡
Working remotely
View GitHub Profile
@libbyschuknight
libbyschuknight / sinatra_skeleton.txt
Last active August 29, 2015 14:27
Commands to use Sinatra Skeleton (EDA) and re-initialise for a different repo
$ 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.
@libbyschuknight
libbyschuknight / BookParser_class.rb
Created August 11, 2015 02:36
Google Books API example
require "httparty"
class BookParser
attr_accessor :data
def initialize(data)
@data = HTTParty.get(data).parsed_response
load_books
end
@libbyschuknight
libbyschuknight / application.js
Created August 10, 2015 03:02
Example code for ajax calls for Hacker News
$(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 ({
@libbyschuknight
libbyschuknight / test_example_api.rb
Last active August 29, 2015 14:27
Example test for api
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
.ui-widget-header,.ui-state-default, ui-button{
background:#b9cd6d;
border: 1px solid #b9cd6d;
color: #FFFFFF;
font-weight: bold;
}
$(document).ready(function() {
//run the code
// console.log("this is loading")
$(document).keyup(function(e) {
// console.log(e)
updatePlayerPosition(e.keyCode)
});
});
@libbyschuknight
libbyschuknight / using_animate_jquery.js
Created August 3, 2015 03:32
using animate() in jquery
$('img').mouseenter(function () {
$(this).css({border: '0 solid #f37736'}).animate({
borderWidth: 4
}, 500);
}).mouseleave(function () {
$(this).animate({
borderWidth: 0
}, 500).hide();
});
@libbyschuknight
libbyschuknight / heroku-deployment
Last active August 29, 2015 14:26
Deploying Ruby on Rails app to Heroku
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