Skip to content

Instantly share code, notes, and snippets.

/* Group clauses in this order: */
SELECT select_list [ INTO new_table ]
[ FROM table_source ] [ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
def print_all_names(list_of_names)
list_of_names.each do |item|
print item
end
end
# Arrays are useful for storing different types of data
diverse_array = [1,2,"abc",[9,9,"zzz"]]
# Hashes are useful for lookup data
lookup_hash = {
ssn => 1234,
dob => "December 25th, 2000",
acct_num => 9999
}
# Initialize Hash
my_hash = {}
# Example hash
my_hash = {
:dog => "Leo",
:Birthday => "August, 24th 1990",
:Zodiac => "Virgo"
}
# Initialize Array
my_array = []
# Example Array
my_array = [1,2,3,4,5]
# Array indexes display items starting from 0 to -1
my_array[0] = 1
my_array[-1] = 5
/*Example CSS - follows atomic style CSS*/
.blog-list { /*This line references a class called "blog-list"*/
list-style: none; /*Any lists within this class should not display bullets*/
padding-left: 1em; /*padding to the left of this class element is 1 em*/
}
.page-list {
list-style: square;
margin-top: 0em;
// Accessing JavaScript Object Properties
// Dot Notation
console.log(skateboarder.name) // Prints "Rodney Mullen" to console.
//Brackets
console.log(skateboarder[wheels]) // Prints "undefined" to console.
// The line above evaluates wheels to return "Spitfire", then return undefined as there is no property named "Spitfire".
# Accessing Ruby Hash Value
print grades[:Jane] #=> prints value 89
grades = {
Jane: 89,
Bill: 88,
James: 95,
Jill: 94
}