⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoggleBoard | |
def initialize(arrays) # Initialize Class. | |
@arrays = arrays | |
end | |
def create_word(*coords) # Method takes *splat arguments. | |
coords.map { |coord| @arrays[coord.first][coord.last]}.join("") # Iiterastes through nested-array to create new array. | |
end # Uses #join to create new string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Id CommandLine | |
-- ----------- | |
202 cd .\DBC | |
203 ls | |
204 cd.. | |
205 ls | |
206 git add "sample gist" | |
207 git add sample gist | |
208 git add "sample gist.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DOM manipulation with jQuery</title> | |
<!-- Add a link to jQuery CDN here script here --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script type="text/javascript" src="jquery_example.js"></script> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\e[H \e[2J" #moves to home & clears screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
#creates headers as symbols from top row data | |
def people | |
return @people if @people # If we've already parsed the CSV file, don't parse it again. It's nil so it parses. | |
@people = [] # Remember: @people is +nil+ by default. So turn it into an Array. | |
CSV.foreach(@file, :headers => true, :header_converters => :symbol) do |row| | |
@people << Person.new(row[:id], row[:first_name], row[:last_name], row[:email], row[:phone], row[:created_at]) | |
end # do | |
@people |
Database Drill Intro To Sqlite Learning Competencies
Create and modify a database in SQLite
Model relationships in a relational database (one-to-one, one-to-many, many-to-many)
Summary
SQLite is a really simple relational database. Every database is a single file, which you can move around.
You should already have SQLite installed. The default way SQLite displays data is not great though, so paste the following into your Terminal:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if/elsif/else: | |
if expression | |
# Do something. Otherwise do nothing and got to next section of code. | |
end | |
if expression | |
# Do something | |
else | |
# Do yet another thing. Default response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The 'For' Loop: | |
# A while loop checks to see if a certain condition is true, and while it is, the loop keeps running. | |
# As soon as the condition stops being true, the loop stops! Beware infinite loops! | |
counter = 1 | |
while counter < 11 | |
puts counter | |
counter = counter + 1 | |
end |
OlderNewer