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
| IO.puts "hello world!" |
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
| events/_forms.html.erb | |
| <div class="form-group test"> | |
| <%= f.label :auctions, class: "col-lg-4 col-sm-2 control-label required" %> | |
| <div class="col-lg-8" id="filter"> | |
| <%= f.collection_select :auction_ids, filter_auction, :id, :name, {}, {:multiple => true, class: "form-control acution-class", required: true}%> | |
| </div> | |
| </div> | |
| <script> |
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 easiest way to screw up one of these iterating methods is to change the collection out from underneath the method. | |
| #Here, for example, is a seriously misguided attempt to remove all of the negative numbers from an array: | |
| array = [ 0, -10, -9, 5, 9 ] | |
| array.each_index {|i| array.delete_at(i) if array[i] < 0} | |
| pp array | |
| #The trouble with this code is that it will tend to leave some negative numbers behind: Removing the first one (the -10 ) from | |
| #the array messes up the internal indexing of the each method, so much that it will miss the second negative number, leaving | |
| #us with a result of: |
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
| #Usual way | |
| unique = [] | |
| words.each { |word| unique << word unless unique.include?(word) } | |
| #What we really need is a collection that doesn’t allow duplicates but does feature very fast and easy answers to the “is this | |
| #object in there?” question. The punch line is that we need a set. Fortunately, Ruby comes with a perfectly serviceable, if | |
| #sometimes forgotten, | |
| #Set class: |
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
| puts 'yes yes'.sub( 'yes', 'no' ) | |
| => no yes | |
| puts 'yes yes'.gsub( 'yes', 'no' ) | |
| => no no |
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
| Rspec:: | |
| rspec | |
| rspec spec/models | |
| rspec spec/controllers/accounts_controller_spec.rb | |
| rails generate rspec:model | |
| /factories /support /models /controllers /features /views /mailers /routing /helpers | |
| Model spec - behavior of model | |
| require "rails_helper" |
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
| Connect to Server(ssh) | |
| sudo apt-get install ufw | |
| sudo ufw allow 80 (port http) | |
| sudo ufw allow 443 (port https) | |
| sudo ufw allow 22 (port SSH) | |
| sudo ufw enable | |
| sudo ufw reload | |
| sudo ufw status (will list all open ports) |
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
| begin | |
| ActiveRecord::Base.transaction do | |
| User.create(name: 'test') | |
| Role.create(name:'manager') | |
| end | |
| rescue => e | |
| raise ActiveRecord::Rollback | |
| 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
| Change in config/environments/production.rb | |
| config.assets.compile = true | |
| Change in config/initializers/devise.rb | |
| config.secret_key = '34790ca67ba55291b876053e2de5a248059345fd3994ada01bc4f16a4b272dedcffdee6c71f9a4b3a92773462686c9ee4a0753b02efcc26d14e6ee11cb9fc9c6' | |
| Change in config/secrets.yml | |
| secret_key_base: 32790ca67ba55234b876053e2de5a248059345fd3994ada01bc4f16a4b272dedcffdee6c71f9a4b3a92773462686c9ee4a0753b02efcc26d14e6ee11cb9fc9c6 | |
| Configure database.yml with production 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
| sqlcmd -S localhost -U SA -Q "BACKUP DATABASE web_ilids_development TO DISK = N'/var/opt/mssql/data/web_ilids_development.bak' WITH NOFORMAT, NOINIT, NAME = 'web_ilids_development-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10" | |
| https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-backup-and-restore-database | |
| https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#ubuntu |
OlderNewer