Skip to content

Instantly share code, notes, and snippets.

View kayline's full-sized avatar

Molly Trombley-McCann kayline

View GitHub Profile
@kayline
kayline / route_check.rb
Last active August 29, 2015 13:56
Write an Rspec test to assert that all your public API endpoints have matching rspec_api_documentation tests.
class RouteCheck
attr_reader :routes, :world
def initialize(routes: nil, world: nil)
@routes = routes
@world = world
end
def filtered_routes
collect_routes do |route|
@kayline
kayline / tutorial.md
Last active December 18, 2015 00:59

Views: Sinatra vs Rails

###Auto-Matching### Inside a given controller, each action will by default render a template with the same name as the action

class BooksController < ApplicationController
  def index
    #will automatically render app/views/books/index.html.erb
 end
@kayline
kayline / index.html
Last active December 17, 2015 16:19 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@kayline
kayline / zoo.js
Last active December 17, 2015 16:19 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
var Zoo = {
animals : [],
init : function(animal_array){
animals = animal_array;
},
animals : function(){
return animals
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.
https://github.com/kayline/ar-student-schema.git
@kayline
kayline / Fibby Try One
Created March 22, 2013 02:32
First attempt at identifying Fibonacci number-foiled by floating point inaccuracy in large values
def is_fibonacci?(i)
puts "The number to test is #{i}"
sum_test = 5 * i ** 2 + 4
diff_test = 5 * i ** 2 - 4
puts "Sum test = #{sum_test} and diff test = #{diff_test}"
sum_test_intrt = (sum_test ** 0.5).to_i ** 2
diff_test_intrt = (diff_test ** 0.5).to_i ** 2
puts "Rounded sum root = #{sum_test_intrt} and diff root = #{diff_test_intrt}"
if sum_test == sum_test_intrt && diff_test != diff_test_intrt
puts "Fibby!"
# Determine whether a string contains a Social Security number.
def has_ssn?(string)
#check overall length
if string.length < 11
return false
#check for match
elsif string.match(/\d{3}(-)\d{2}(-)\d{4}/)
return true
else
return false