Skip to content

Instantly share code, notes, and snippets.

@ianyang
ianyang / GA Day2-3.md
Created June 20, 2013 02:02
Array, Hashes & Loops

General

  • method_name() to run a method with no parameters
  • .split splits a string into an array based on spaces
    • .split() splits a string into an array with the value inside the parens
    • "\n" is class block
  • Make sure the remember that an array starts with 0, and so the top number needs to be subtracted by 1
@alexaltair
alexaltair / Today's Learning.md
Last active December 18, 2015 17:38
An exploration of infinite lists.

The first thing that really surprised me today was the flexibility of Ruby's shovel operator, <<. A student in the class had tried the following:

a = [0]
a << a

What do you think a is now? I was sure it would be [0, [0]]. But lo and behold, Ruby sparkles;

a = [0]
a &lt;&lt; a

#Homework for June 18, 2013

##Calculator 1 Create a command line calculator. It should have a basic and advanced mode.

basic calculator (+, -, *, /) advanced calculator (exponents, square root)

For a basic calculator, press 1.

@screamingmunch
screamingmunch / Wk1_Tue(Day2).md
Last active December 18, 2015 15:49
GA Lecture Notes

tl;dr: Ruby Arrays,

Objectives:MVC & Testing , Arrays & Functions ,Networking & HTTP

Ruby "Strings" vs. [Arrays]

    array: an Object with ordered storage container
```Ruby names = ["Travis", "Megan", "Tod", "Bryan"] #literal array- what you see is what you get, also json (JS object notation)
@screamingmunch
screamingmunch / Wk1_Mon(Day1).md
Last active December 18, 2015 14:49
Terminal Commands, Shebang, #!/usr/bin/env ruby, chmod, cat, less

Day 1 of GA WDI program: we spent majority of the class in terminal(shell), getting comfortable with command line prompts. We also played with some Ruby in and Sublime Text. All in all, a good review of all the prep work on command line stuff. Ubuntu isn't as scary as when I first installed it yesterday.

tl;dr: Terminal Commands, Shebang #!/usr/bin/env ruby, chmod a+x demo.rb , Literals, cat, less.

file_name.md --> md stands for markdown file type

Linux:

Ctrl + to zoom in (in apple: Cmd +)