This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initialize a stack | |
# for each character in the input string | |
# if character == ")" | |
# initialize a 'to_compute' stack | |
# while last char in stack is NOT '(' | |
# pop from stack and push onto the 'to_compute' stack | |
# pop the '(' from the stack | |
# stack << calculate(to_compute) | |
# else | |
# push onto stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = CarProblemsController | |
c.instance_methods.include?(:before_filter) | |
=> false | |
c.methods.include?(:before_filter) | |
=> true | |
class << c | |
p self.instance_methods.include?(:before_filter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FunkyHash < Hash | |
def initialize(hash) | |
@hash = hash | |
@hash.each do |k, v| | |
self.class.send(:define_method, k) { v } | |
end | |
create_hash | |
end | |
def create_hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DOM manipulation with jQuery</title> | |
<!-- Add a link to jQuery CDN here script here --> | |
<script type="text/javascript" src="jquery_example.js"></script> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoggleBoard | |
attr_reader :board | |
def initialize(board) | |
@board = board | |
puts board | |
end | |
def create_word(*coords) |