Skip to content

Instantly share code, notes, and snippets.

View ConorFl's full-sized avatar

Conor Flanagan ConorFl

View GitHub Profile
To create a second name for the variable or method.
alias
A command that appends two or more objects together.
and
Designates code that must be run unconditionally at the beginning of the program before any other.
BEGIN
Delimits a "begin" block of code, which can allow the use of while and until in modifier position with multi-line statements.
http://min.us/liueSPMQD9ZCN
Count Queries
1. There are 240 Republican representatives.
2. There are 187 Democratic representatives.
3. There are 51 Democratic senators, 47 Republican senators.
The questions asks for "representatives", but the details below it ask to specify if it's a Rep or Sen, so we've
compiled the lists using all Rep's and Sen's.
select name, location, party, substr(name, 0, 4), years_in_congress from congress_members order by grade_level_since_1996 limit 10;
class Cohort < Database::Model
def self.all
Database::Model.execute("SELECT * FROM cohorts").map do |row|
Cohort.new(row)
end
end
def self.create(attributes)
record = self.new(attributes)
record.save
<!-- Code goes here -->
require 'csv'
require 'sqlite3'
class CongressParser
$db = SQLite3::Database.new "congress_members.db"
attr_accessor :file, :congress_members
def initialize(file)
@file = file
@ConorFl
ConorFl / cohort.rb
Last active December 15, 2015 12:28
class Cohort < Database::Model
self.table_name = 'cohorts'
attr_reader :attributes, :old_attributes
# e.g., Cohort.new(:id => 1, :name => 'Alpha', :created_at => '2012-12-01 05:54:30')
def [](attribute)
https://github.com/tinybeauts/flashcards_web_app.git
.container {
/*
If you have a block-level element of a certain width, margin: 0 auto;
will how you center it inside its parent container.
See: http://bluerobot.com/web/css/center1.html
Don't change the container width.
*/
margin: 0 auto;
.container {
/*
If you have a block-level element of a certain width, margin: 0 auto;
will how you center it inside its parent container.
See: http://bluerobot.com/web/css/center1.html
Don't change the container width.
*/
margin: 0 auto;
<form name="sign_up" action="#" method="post">
<label for="email">Email</label>
<input type="text" name="email" />
<label for="password">Password</label>
<input type="password" name="password" />
<button type="submit">Sign Up</button>
<ul id="errors"></ul>
</form>