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
Prawn::Errors::CannotFit: Prawn::Errors::CannotFit | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:199:in `update_output_based_on_last_fragment' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:190:in `fragment_finished' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:112:in `block in add_fragment_to_line' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:96:in `each' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:96:in `add_fragment_to_line' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/line_wrap.rb:81:in `block in apply_font_settings_and_add_fragment_to_li | |
ne' | |
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/prawn-2.1.0/lib/prawn/text/formatted/arranger.rb:243:in `apply_font_size' | |
from |
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
using UnityEngine; | |
using System.Collections; | |
public class PlayerController : MonoBehaviour { | |
Rigidbody2D rbody; | |
Animator anim; | |
public float maxSpeed = 10; | |
public float walkSpeed = 2; |
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
workbook = RubyXL::Parser.parse("testdb.xlsx") | |
worksheet = workbook[0] | |
puts worksheet[0].size.to_s | |
worksheet.each do |row| | |
val = row[0].value | |
if val != nil | |
puts val.to_s | |
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
workbook = RubyXL::Parser.parse("testdb.xlsx") | |
worksheet = workbook[0] | |
worksheet.each do |row| | |
val = row[0].value | |
puts val | |
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
#The model section: | |
class Subject < ActiveRecord::Base | |
validates :name, :sex, :initial, :phone, :born_on, presence: true | |
validates :initial, :email, :phone, uniqueness: true, unless: :skip_unique_validation | |
validates :phone, format: { with: /\d/, | |
message: "allows only numbers" } | |
attr_accessor :skip_unique_validation |
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
Model: | |
class Subject < ActiveRecord::Base | |
validates :name, :sex, :initial, :phone, :born_on, presence: true | |
validates :initial, :email, :phone, uniqueness: true, unless: :skip_unique_validation | |
validates :phone, format: { with: /\d/, | |
message: "allows only numbers" } | |
attr_accessor :skip_unique_validation |
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
Started POST "/subjects" for ::1 at 2016-05-06 13:30:00 +0200 | |
Processing by SubjectsController#create as HTML | |
Parameters: {"utf8"=>"V", "authenticity_token"=>"NxFf40TMU9j3Yj6/0a0kQlvpGREHgckCo2XYCfpMmx3gQc9Pzcy9IUMcOIUBDw/Lwfix3oX+BqhY8DrSa/NC4w==", "subject"=>{"name"=>"dasda", "sex"=>"dsa", "i | |
nitial"=>"asda", "email"=>"aasd@dasdsada.dk", "phone"=>"124141241", "born_on"=>"1988-06-01", "scale_weight"=>"252.0", "scale_height"=>"146.0", "medicine"=>"", "known_disease"=>"", "family | |
_disposition"=>"", "other"=>""}, "commit"=>"Save Subject"} | |
(0.0ms) begin transaction | |
Subject Exists (0.0ms) SELECT 1 AS one FROM "subjects" WHERE "subjects"."initial" = 'asda' LIMIT 1 | |
Subject Exists (0.0ms) SELECT 1 AS one FROM "subjects" WHERE "subjects"."email" = 'aasd@dasdsada.dk' LIMIT 1 | |
Subject Exists (0.0ms) SELECT 1 AS one FROM "subjects" WHERE "subjects"."phone" = '124141241' LIMIT 1 | |
(0.0ms) rollback transaction |
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
#Åbner excel-filen | |
xlsx = Roo::Spreadsheet.open(filename) | |
#Loader alle ark i et array | |
sheetArray = xlsx.sheets | |
sheetArray.each_with_index { |sheet, i| | |
@volt_raw + i = xlsx.sheet(sheet).column(2) | |
} | |
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 retrieve_data(sheets) | |
array = get_values(sheets) | |
p array | |
end | |
def get_values(sheets) | |
sheets.each do |s| | |
puts "Working..." | |
s.each do |row| unless row.nil? | |
row.cells.map do |cell| |
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 get_values(sheets) | |
sheets.flat_map do |sheet| | |
array = Array.new | |
array << sheet.flat_map do |row| | |
row ? row.cells.map { |cell| cell.value if cell } : [] | |
end | |
return array | |
end | |
end |
OlderNewer