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 Class | |
def remove | |
puts "find hash to remove" | |
search = $stdin.gets.chomp.each_line(separator=" ").to_a | |
result = address_book.query search | |
#puts result => returns expected hash | |
address_book.remove result | |
end |
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
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
config.autoload_paths += %W(#{config.root}/lib) | |
require 'ext/string' | |
# Require the gems listed in Gemfile, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(:default, Rails.env) |
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
@import 'books.css.scss' |
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
[............] | |
# code wich is inside the loop and has the odd, even cycle css pattern | |
<% @books.each do |book| %> | |
<tr class=<%= cycle("odd", "even") %>> | |
<td><%= book.id %></td> | |
<td><%= book.author.name %></td> |
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
<%= form_for([@author, @book]) do |f| %> | |
<% if @book.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2> | |
<ul> | |
<% @book.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
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 BooksController < ApplicationController | |
def index | |
@books = Book.all # # this variable doesn't get loaded with " render " | |
respond_to do |format| | |
format.html | |
format.yaml { render text:@books.to_yaml } | |
format.json { render text:@books.to_json } |
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
var sizes = { | |
'-small' : 200, | |
'-medium': 600, | |
'-large' : 1040, | |
} | |
for (var suffix in sizes){ | |
if (sizes.hasOwnProperty(suffix)) { | |
var finalName = uploadUrl+fileName+suffix+fileExtension; | |
var stream = fs.createWriteStream(finalName); |
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
var images = gallery.images; | |
for (var i = 0; i < images.length; i++ ) | |
{ | |
console.log(JSON.stringify(images[i])); | |
for (var key in images[i]) | |
{ | |
(function (key) { | |
if (images[i].hasOwnProperty(key)) | |
{ |
OlderNewer