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
.ui-widget-header,.ui-state-default, ui-button{
background:#b9cd6d;
border: 1px solid #b9cd6d;
color: #FFFFFF;
font-weight: bold;
}
@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
@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 / 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 / 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 / API_documentation_example.md
Last active August 29, 2015 14:27
example API documentation layout

[GET] list of users

  • returns list of user objects includes id, name, username, email, and bio
  • /api/v1/users/
  • example: [ { "id": 1, "username": "genevieve_hauck", "email": "[email protected]", "name": "Patience Ondricka", "bio": "Assumenda laudantium delectus similique aspernatur quibusdam quasi recusandae. Blanditiis repudiandae fuga fugiat. Ab non qui." }, { "id": 2, "username": "laurie.hermann", "email": "[email protected]", "name": "Mr. Taurean Schneider", "bio": "Dolor architecto iusto. Maxime et ab enim neque ratione. Non molestias quisquam qui sunt iure et. Tenetur eum repellat autem et est ipsam." } ]

[GET] list of articles

  • returns list of article objects. Includes id, user_id, title, body.
  • /api/v1/articles/
  • example: [ { "id": 1, "title": "nam", "body": "Autem deleniti maiores et ut. Possimus nihil ut laboriosam eos. Deserunt excepturi dignissimos dolorem velit fuga iure. Voluptate consequatur recusandae. Dolorum inventore rerum animi voluptatem natus.", "user_id
@libbyschuknight
libbyschuknight / python_server_command
Created August 20, 2015 22:42
Command for running python sever, use 3005
python -m SimpleHTTPServer 3005
@libbyschuknight
libbyschuknight / git_tags
Created August 27, 2015 00:43
Adding and pushing tags in Git
git tag slice02
git push origin --tags
@libbyschuknight
libbyschuknight / rspec
Created August 29, 2015 09:39
rspec stuff
have rpsec format as 'documentation
https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/format-option
run from terminal
$ rspec spec --format documentation
add to .rspec file so tests are always in this format
--format documentation
Nyan Cat - just for fun!
###########################
# Configuration for rubocop
# in .rubocop.yml
# Most of these are disabling existing cops, primarily
# due to a smattering of different styles and loose
# guidlines for contributions.
#
# Any of these may be changed.