Skip to content

Instantly share code, notes, and snippets.

View MilanGrubnic70's full-sized avatar

Milan Grubnic MilanGrubnic70

View GitHub Profile
@MilanGrubnic70
MilanGrubnic70 / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
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.
@MilanGrubnic70
MilanGrubnic70 / Command Line Obstacle Course Challenge
Created February 15, 2014 20:18
Command Line Obstacle Course Challenge
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"
@MilanGrubnic70
MilanGrubnic70 / jquery_example.html
Last active August 29, 2015 13:57 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
<!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>

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@MilanGrubnic70
MilanGrubnic70 / Reset Terminal Screen
Created April 12, 2014 20:24
Resetting a Terminal screen.
puts "\e[H \e[2J" #moves to home & clears screen
@MilanGrubnic70
MilanGrubnic70 / CSV.rb
Last active August 29, 2015 13:59
CSV: Parsing and updating/appending.
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
@MilanGrubnic70
MilanGrubnic70 / Image URL.md
Created April 13, 2014 23:10
Post and image in Markdown.

Description

@MilanGrubnic70
MilanGrubnic70 / SQL.md
Last active August 29, 2015 13:59
SQL Basics

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:

@MilanGrubnic70
MilanGrubnic70 / control_flow.rb
Last active August 29, 2015 14:00
Control Flow: if, elsif, else, unless...
# 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.
@MilanGrubnic70
MilanGrubnic70 / loops.rb
Last active August 29, 2015 14:00
Loops: while, until, & for
# 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