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
| def while_loop(numbers) | |
| i = 0 | |
| answer = 0 | |
| while i < (numbers.length) | |
| answer += numbers[i] | |
| i += 1 | |
| end | |
| return answer | |
| 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
| def find_largest(numbers) | |
| master_list = Array.new | |
| list = numbers.permutation.to_a | |
| list.map do |l| | |
| master_list << l.join | |
| end | |
| master_list.sort.last | |
| end | |
| numbers = [1, 20, 3, 49, 442] | |
| puts find_largest(numbers) |
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
| module Denkgroot | |
| include ActiveSupport::Configurable | |
| config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures | |
| self.title = "denkGroot thema" | |
| self.page_parts = [ | |
| { name: 'text', title: 'Text', page_partable_type: "Spina::Text" }, | |
| { name: 'teaser', title: 'Teaser', page_partable_type: "Spina::Line" }, |
First, Create a folder inside of lib called seeds
Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv
Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.
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
| The MIT License (MIT) | |
| Copyright (c) 2015 Justin Perry | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| this software and associated documentation files (the "Software"), to deal in | |
| the Software without restriction, including without limitation the rights to | |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
| the Software, and to permit persons to whom the Software is furnished to do so, | |
| subject to the following conditions: |
OlderNewer