This file contains 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
def show | |
puts "Outputting a very lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong line" | |
@widget = Widget(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @widget } | |
end | |
end |
This file contains 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
"devDependencies": { | |
"gulp": "~3.8.7", | |
"gulp-compass": "~1.1.3", | |
"gulp-concat": "~2.1.7", | |
"gulp-minify-css": "~0.3.0", | |
"gulp-notify": "^1.5.0", | |
"gulp-ruby-sass": "~0.2.0", | |
"gulp-uglify": "~0.1.0", | |
"gulp-util": "~2.2.12", | |
"gulp-watch": "~0.5.0", |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<link rel="icon" href="../../favicon.ico"> |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 RPNCalculator | |
def initialize(expression) | |
@expression = expression | |
end | |
def evaluate(expression) | |
container = @expression.split(' ') | |
num_container = [] | |
container.each do |x| | |
if !(x == '+' || x == '-' || x == '*') |
This file contains 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
# Don't forget to check on intialization for a card length | |
# of exactly 16 digits | |
class CreditCard | |
#Initialize CreditCard object | |
#make sure it return argument errror if not 16 digits | |
#thinking I need a regex that can take any string input and tell if it | |
#contains exactly 16 digits | |
def initialize(number) | |
unless number =~ /(\d{4})(\s*)(\d{4})(\s*)(\d{4})(\s*)(\d{4})/ |
This file contains 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
# Method from Chris Pine for figuring out | |
# continent size in Civilization III | |
# with added return conditional for spots at the 'edge of the earth' | |
M = 'land' | |
o = 'water' | |
world = [[M,o,o,o,o,o,o,o,o,o,o], | |
[M,o,o,o,M,M,o,o,o,o,o], |
This file contains 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
# Code from Codeacademy working on using class variables and class methods | |
class Computer | |
@@users = {} | |
def initialize(username, password) | |
@username = username | |
@password = password | |
@files = {} | |
@@users[username] = password |
This file contains 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 Account | |
attr_reader :name | |
attr_reader :balance | |
def initialize(name, balance = 100) | |
@name = name | |
@balance = balance | |
end |
This file contains 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
def separate_comma(number) | |
number.to_s.gsub(/(\d)(?=(\d{3})+$)/, '\1,') | |
end |
OlderNewer