Skip to content

Instantly share code, notes, and snippets.

@pvergel
pvergel / jquery_example.html
Last active August 29, 2015 13:55 — 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>
@pvergel
pvergel / gist:8254322
Created January 4, 2014 11:11
COMMAND LINE OBSTACLE COURSE
356 cd desktop
357 ls
358 cd CLI-Obstacle-Course
359 ls
360 find Gemfile
361 find ls
362 find Gemfile -ls
363 ls -a
364 cd images
365 ls
@pvergel
pvergel / 0.2.1-boggle_class_from_methods.rb
Last active December 31, 2015 20:39 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(dice_grid)
@dice_grid=dice_grid
end
def create_word(dice_grid, *coords)
coords.map { |coord| @dice_grid[coord.first][coord.last]}.join("")
end
@pvergel
pvergel / gist:7961098
Created December 14, 2013 16:07
FAILED REVERSE POLISH NOTATION
#calc = RPNCalculator.new
#calc.evaluate('1 2 +') # => 3
#calc.evaluate('2 5 *') # => 10
#calc.evaluate('50 20 -') # => 30
# The general rule is that 'A B op' is the same as 'A op B'
# i.e., 5 4 - is 5 - 4.
#calc.evaluate('70 10 4 + 5 * -') # => 0
@pvergel
pvergel / gist:7795862
Last active December 30, 2015 07:28
FIBONACCI: ITERATION VS RECURSION
# Your Names:
# 1) Pablo
# 2) Luis
# For each solution below:
# 1. Read each line of code. Write a comment above each method that explains what
# it's doing and how.
# 2. Is this an iterative or recursive solution? How can you tell?
# 3. Consider the variable and method names. What do you think about them?
# Could they be more clear?
@pvergel
pvergel / gist:7674058
Created November 27, 2013 11:12
Hey, anyone understands why this each method doesnt compute for this SuperFizzBuzz classic??? I was forced to use array.length instead...
def super_fizzbuzz(array)
array.each do |i|
if array[i] % 15 == 0 then array[i]="FizzBuzz"
elsif array[i] % 5 == 0 then array[i]="Buzz"
elsif array[i] % 3 == 0 then array[i]="Fizz"
else
array[i]
end
end
array
@pvergel
pvergel / gist:7638210
Created November 25, 2013 08:33
I am going crazy trying to figure it out why this Ruby Lab exercise doesnt work...
# longest_string is a method that takes an array of strings as its input
# and returns the longest string
#
# +array+ is an array of strings
# longest_string(array) should return the longest string in +array+
#
# If +array+ is empty the method should return nil
def longest_string(array)
# Your code goes here!
end