Skip to content

Instantly share code, notes, and snippets.

# Solution for Challenge: Poll DB 1: Queries. Started 2013-07-08T21:40:24+00:00
SELECT * FROM congress_members;
SELECT sql FROM (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x FROM sqlite_master UNION ALL SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'ORDER BY substr(type,2,1), CASE type WHEN 'view' THEN rowid ELSE name END
SELECT * FROM congress_members
WHERE id='524';
SELECT * FROM votes
WHERE politician_id = '524';
SELECT count(id) FROM votes
@elephantsofneptune
elephantsofneptune / sudoku.rb
Created April 28, 2017 09:59 — forked from fern4lvarez/sudoku.rb
Implementation of a Sudoku solver in Ruby
#
# This module defines a Sudoku::Puzzle class to represent a 9x9
# Sudoku puzzle and also defines exception classes raised for
# invalid input and over-constrained puzzles. This module also defines
# the method Sudoku.solve to solve a puzzle. The solve method uses
# the Sudoku.scan method, which is also defined here.
#
# Use this module to solve Sudoku puzzles with code like this:
#
# require 'sudoku'
@elephantsofneptune
elephantsofneptune / README.md
Created April 28, 2017 04:02 — forked from mattsears/README.md
Todo.rb: A simple command-line TODO manager written in Ruby

Todo.rb

Todo.rb is a simple command-line tool for managing todos. It's minimal, straightforward, and you can use it with your favorite text editor.

Getting Started

Todo.rb doesn't require any third-party gems so you can copy the file anywhere and use it as long as it's executable:

@elephantsofneptune
elephantsofneptune / flashcard.rb
Created April 28, 2017 03:26 — forked from gvirav/flashcard.rb
flashcardinator
# As a flashcard user, I'd like to be able to go through one flashcard at a time, so I can memorize the definitions and terms.
class Deck
attr_accessor :cards
def initialize
@cards = []
@guess = guess
end
@elephantsofneptune
elephantsofneptune / Flashcards
Created April 28, 2017 03:13 — forked from kmandreza/Flashcards
Ruby Flashcards 1: Single Deck Let's build a simple flashcard game in Ruby with a command-line interface. Here is an example of one possible implementation: $ ruby flashcards.rb Welcome to Ruby Flash Cards. To play, just enter the correct term for each definition. Ready? Go! Definition A file format in which values are delimited by commas. Guess…
class Flashcard #data structure
attr_accessor :term, :definition
def initialize(term,definition)
@term=term
@definition=definition
end
end
@elephantsofneptune
elephantsofneptune / racer_utils.rb
Created April 26, 2017 10:53 — forked from yclim95/racer_utils.rb
R-r-r-r-r-ruby Racer!
class Dice
def initialize(sides = 6)
@sides = sides
end
# Remember: rand(N) randomly returns one of N consecutive integers, starting at 0
# So rand(N) returns a random integer in (0..N-1)
# And 1 + rand(N) returns a random integer in (1..N)
# See: http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-rand
def roll