Skip to content

Instantly share code, notes, and snippets.

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
@elenawalom
elenawalom / Day 5 Notes
Last active December 18, 2015 19:29
Day 5 Notes
We need to know about:
variables, objects, types, and loops.
Variables are references to things that we create in our program. WE give them nice names so that code becomes readable.
12tmp = not variable
tmp12 = variable because variables have to start with letter
Title: Pop-Quiz
===
Category: Monty Python & the Holy Grail
---
### Question: What is your favorite color?
Answer: Blue... no, YELLOOOOOOOW!
@elenawalom
elenawalom / notecards.md
Last active December 19, 2015 00:59
notecards.md

When using Sinatra, how do you direct your code to a new page?

  • erb :(desired location)

Create a hash using a literal and another using new

# Option A
my_hash = {}
@elenawalom
elenawalom / Wk2Day4Notes
Created June 27, 2013 23:10
Wk2Day4Notes
What problem does Git solve?
*Data backup
*Remote access
What is version control?
Reference older versions of your code.
@elenawalom
elenawalom / Wk2Day5Notes
Created June 28, 2013 18:26
Wk2Day5Notes
For safe SQL execution, Google the following words:
Name of programming language, name of programming engine, and the word injection
(I.e. Ruby, SQLite, injection)
Task Code
Change the background color of '#target' by script. $('#target').css('background', 'blue');
Change the text in the span, a child of '#target' $('#target span').text('foo:bar');
Create a clone of the span in '#target' and position it under the orgin. $('#target span').clone().insertAfter('#target span');
Change background color of the second of three '.target'. $('.target').eq(1).css('background', 'blue');
Disable the button $('.target button').attr('disabled', 'disabled');
Uncheck the boxes $('.target input').removeAttr('checked');
Move '#child' from '#parent1' to '#parent2' $('#child').appendTo('#parent2');
Make the textbox in '#target' read-only $('#target input').attr('readonly', 'readonly')

How to start

  • deconstruct a program and turn it into steps-comment out in the editor
  • start with the most simple step
  • test small things in the console to reaffirm basic assumptions (do my expectations meet my results?)
  • DIVIDE AND CONQUER

##jQuery

  • div divides blocks
  • span divides in-line text
  • grabs something on the page and can see the value
@elenawalom
elenawalom / Project Preparation
Created July 12, 2013 00:58
Project Preparation
Table:
Derby (person types in :pillbox fascinator, top hat, fascinator,
Website URL will be _____.heroku.com
App that looks for accessories appropriate for event on Etsy.