Skip to content

Instantly share code, notes, and snippets.

@alicht
alicht / about-me-page.markdown
Created December 6, 2017 14:28
About Me Page
var backgroundOpacity = jQuery("<div>").css({
position: "fixed",
top: 0,
left: 0,
width: "100%",
height: "100%",
backgroundColor: "rgba(0,0,0,0.5)",
zIndex: 25,
display: "none"
});
for (var i=1; i <= 20; i++) {
if ( num % 15 = 0 )
console.log("Fizzbuzz")
else if ( num % 5 = 0)
console.log("Buzz")
else if (num % 3 = 0 )
console.log("Fizz")
else
console.log(i)
### Keybase proof
I hereby claim:
* I am alicht on github.
* I am alicht (https://keybase.io/alicht) on keybase.
* I have a public key whose fingerprint is EB9D 8865 B486 0AA7 5DD4 3E14 1E53 ACA5 0204 92F9
To claim this, I am signing this object:

Form_for

  • Most magical form helper in rails
  • form_for is a ruby method into which a ruby object is passed
  • form_for yields a form builder object (typically f)
  • methods to create form controls are called on f, the form builder element
  • when the object is passed as a form_for parameter, it creates corresponding inputs with each of the attributes
    • if i had form_for(@cat), then the form field params would look like cat[name], cat[color], etc
  • in keeping with Rails convention regarding RESTful routes, there should be a resource declared for each model object (eg, resources :cats)
puts "Christina Cannito"
puts "Avi Lichtschein"
puts "George Taveras"
puts "Hannah Kim"
#then we had to randomize our names, so a random name would be selected. See code below
@alicht
alicht / tictactoe.rb
Created March 12, 2014 15:26
Tic-Tac-Toe written in Ruby
# Establishing what the board pieces are now, so I can call it below during the introduction
board_pieces = ["X" , "0"]
@player1 = "X"
@player2 = "0"
# Introducing the players
puts "Welcome! Lets play Tic Tac Toe!"
puts "Player 1, what is your name?"
@player1_name = gets.chomp.capitalize