Skip to content

Instantly share code, notes, and snippets.

class Sudoku
#so effing close it's not even funny.
def initialize(board_string)
board_string_array = board_string.split('')
@rskelley9
rskelley9 / my_map.rb
Created September 2, 2013 08:26
My Map method.
class Array
def my_map(&block)
self.each_index do |i|
yield (self[i] = block.call(self[i]))
end
end
end
a = [1,2,3,4]
def fibonacci_iterative(n)
fibonaccis = [0,1]
until fibonaccis.length > n
fibonaccis.push(fibonaccis[-1] + fibonaccis[-2])
end
fibonaccis[n]
end
def fibonacci_recursive(n)
if n == 0
@rskelley9
rskelley9 / SudokuSolver.rb
Last active December 22, 2015 04:48
Sudoku Solver works for all boards from beginner to advanced that don't require guessing. Yeeuh boi.
class Sudoku
#RKelley is boss.
def initialize(board_string)
board_string_array = board_string.split('')
@board = Array.new(9){Array.new(9)}
@rskelley9
rskelley9 / ScrapingHN1.rb
Last active December 22, 2015 07:39
In progress.
# Solution for Challenge: Scraping HN 1: Building Objects. Started 2013-09-04T16:13:44+00:00
require 'nokogiri'
require 'open-uri'
class Post
attr_reader :title, :url, :points, :item_id
def initialize((post),title, url, points, item_id)
@comments = []
require 'net/http'
require 'nokogiri'
class Page
def initialize(url)
@links = doc.search(url)('.body> a:first_child').map{|link| link}
@rskelley9
rskelley9 / Bernies_Works.rb
Last active December 22, 2015 09:49
Working Bernies Bistro that I fixed. Ryan.fail!
require 'csv'
class Recipe
attr_reader :id, :name, :description, :ingredients, :directions
def initialize(id, name, description, ingredients, directions)
@id = id
@name = name
@description = description
require 'sqlite3'
require_relative 'setup_revised'
class Contact
attr_accessor :first_name, :last_name, :company, :phone, :email
def initialize(hash)
@id = hash[:id]

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.
@rskelley9
rskelley9 / index.html
Last active December 24, 2015 00:29 — 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>