Skip to content

Instantly share code, notes, and snippets.

1. There are 5 objects in front of you
2. Each of these objects has a name
3. They are arranged from left to right
4. Left and right are opposites
5. The object closest to you is the furthest to the right
6. The object four objects away from it is the furthest to the left
7. The object furthest to the right is called a plate
8. The object to the left of the plate is called a knife
9. The object to the left of the knife is called Peanut Butter
10. The object to the left of the peanut butter is called jelly
@loganhasson
loganhasson / sql-book-hw
Created September 25, 2013 04:06
List of SQL commands used to complete sql-book homework
/* Part 1 */
CREATE TABLE musicians(
name TEXT,
age INTEGER,
rating REAL,
genre TEXT,
instrument TEXT
);
/* Part 2 */
@loganhasson
loganhasson / ruby-basics.rb
Created September 25, 2013 13:18
Ruby basics To-Do (Tests)
# Download this file:
# https://gist.github.com/aviflombaum/28534c5d69edd2439a7d/download
# Run it from your terminal with:
# ruby ruby.basics.rb
# (Just make sure you are in the right directory)
# ======================================
# Ignore All This Code
# ======================================
@loganhasson
loganhasson / fizzbuzz-loganhasson.rb
Last active December 23, 2015 22:59
FizzBuzz Ruby
# assignment.rb
# FizzBuzz - The Programmer's Stairway to Heaven
# Define the fizzbuzz method to do the following: 10pts
# Use the modulo % method (divisible by)
# 2 % 2 #=> true
# 1 % 2 #=> false
# If a number is divisible by 3, puts "Fizz".
# If a number is divisible by 5, puts "Buzz".
# If a number is divisible by 3 and 5, puts "FizzBuzz"
@loganhasson
loganhasson / logan-playlist-and-quiz
Created September 26, 2013 00:53
Playlist and Quiz from Ruby Lecture 1
##### PLAYLIST #####
# Given:
# 5 songs of the following lengths in seconds
# 223,215,378,324,254
# Goals:
# Assign the length set to variables
# Calculate the Total Length of the Playlists
# Express the Length in Minutes
@loganhasson
loganhasson / bash empty trash
Last active December 23, 2015 23:18
Bash empty trash script
function empty () {
pushd ~/.Trash > /dev/null
tmp=$(rm -rfv * | wc -l | sed -e 's/^[ \t]*//')
if [ $tmp == "1" ]; then
echo "$tmp file was removed."
else
echo "$tmp files were removed."
fi
pushd > /dev/null
}
@loganhasson
loganhasson / bash-profile
Created September 26, 2013 01:34
My .bash_profile
# Configuring Our Prompt
# ======================
# This function is called in your prompt to output your active git branch.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# This function builds your prompt. It is called below
function prompt {
@loganhasson
loganhasson / trash-empty
Last active December 24, 2015 00:09
Move to trash and empty trash from terminal
# USE: trash <filename or dirname>
function trash () {
mv $1 ~/.Trash/$1 > /dev/null
}
# USE: empty
function empty () {
pushd ~/.Trash > /dev/null
tmp=$(rm -rfv * | wc -l | sed -e 's/^[ \t]*//')
songs = [
"The Magnetic Fields - 69 Love Songs - Parades Go By",
"The Magnetic Fields - Get Lost - Smoke and Mirrors",
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945",
"The Magnetic Fields - Get Lost - You, Me, and the Moon",
"The Magnetic Fields - 69 Love Songs - The Book of Love",
"Neutral Milk Hotel - In An Aeroplane Over the Sea - The King of Carrot Flowers"
]
airplane = []
@loganhasson
loganhasson / my.each.rb
Last active December 24, 2015 01:09
My own each iterator
class LoganArray < Array
def my_each
i = 0
while i < self.length do
yield(self[i])
i += 1
end
self
end