├── scripts ├── media_types.rb ├── open_transaction.rb ├── time_with_zone.rb ├── organize_seed_files.rb ├── difference_between_date_and_time_end_of ├── find_in_batches.rb └── play_with_json.rb └── README.md /scripts/media_types.rb: -------------------------------------------------------------------------------- 1 | #Show all media types that rails supports 2 | Mime::SET.collect(&:to_s) 3 | -------------------------------------------------------------------------------- /scripts/open_transaction.rb: -------------------------------------------------------------------------------- 1 | ActiveRecord::Base.transaction do 2 | # methods go here 3 | end 4 | 5 | -------------------------------------------------------------------------------- /scripts/time_with_zone.rb: -------------------------------------------------------------------------------- 1 | # Time.now give you the time of the server, neglecting your configuration of the time zone 2 | # Time.zone.now gives you the accurate time according the configuration in the time zone you made in application.rb 3 | # Example: config.time_zone = 'Singapore' 4 | 5 | Time.now 6 | 7 | Time.zone.now 8 | 9 | -------------------------------------------------------------------------------- /scripts/organize_seed_files.rb: -------------------------------------------------------------------------------- 1 | #Organize your seed files 2 | #You will not need to include your files in the seed file anymore, you can use this convention to run your files in specific order 3 | #In seed Folder: 01_users.rb - 02.model1.rb - 03.model3.rb 4 | #And the line blow will sort them and load each file 5 | 6 | puts "Running seeds" 7 | Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].sort.each { |seed| load seed } 8 | puts "Done" 9 | -------------------------------------------------------------------------------- /scripts/difference_between_date_and_time_end_of: -------------------------------------------------------------------------------- 1 | # False 2 | 3 | DateTime.now.end_of_day == Time.now.end_of_day 4 | 5 | # It is recommended to favor Time over DateTime when it comes to the end of day. Because according to DateTime a time between 23:59:59 and 24:00:00 is # undefined: it is neither before the end of the day nor after the beginning of a day. 6 | 7 | 8 | # The same applies to all time transitions. So all day endings (#end_of_month and #end_of_year), but also #end_of_hour and #end_of_minute. 9 | 10 | 11 | -------------------------------------------------------------------------------- /scripts/find_in_batches.rb: -------------------------------------------------------------------------------- 1 | # ActiveRecord find in batches 2 | # In summary, batch processing allows you to work with the records in batches, thereby instantiating fewer objects and greatly reducing memory consumption. With that handy method, we were able to rewrite our background job and get better results. Using a batch size of 100 allowed us to stay just under the 512mb RAM available at our Heroku worker. 3 | # Taken from: https://blog.codeship.com/improving-rails-performance-better-background-jobs/ 4 | 5 | class ContentSuggestionWorker 6 | include Sidekiq::Worker 7 | 8 | def perform 9 | User.where(subscribed: true).find_in_batches(batch_size: 100) do |group| 10 | group.each { |user| ContentMailer.suggest_to(user).deliver_now } 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /scripts/play_with_json.rb: -------------------------------------------------------------------------------- 1 | # Thanks to drifting ruby 2 | 3 | require 'net/http' 4 | require 'json' 5 | 6 | url = 'http://jsonplaceholder.typicode.com/posts/1' 7 | uri = URI(url) 8 | response = Net::HTTP.get(uri) 9 | standard = JSON.parse(response) 10 | symbol = JSON.parse(response, symbolize_names: true) 11 | struct = JSON.parse(response, object_class: OpenStruct) 12 | 13 | symbol[:name] = 'kobaltz' 14 | struct.name = 'kobaltz' 15 | struct.marshal_dump 16 | 17 | require 'httparty' 18 | require 'json' 19 | url = 'http://jsonplaceholder.typicode.com/posts/1' 20 | response = HTTParty.get(url) 21 | 22 | standard = JSON.parse(response.to_json) 23 | struct = JSON.parse(response.to_json, object_class: OpenStruct) 24 | symbol = JSON.parse(response.to_json, symbolize_names: true) 25 | struct.marshal_dump 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Druid-on-rails 2 | 3 | ![ezgif-4-60ed1d70fc](https://github.com/amrdruid/Druid-on-rails/assets/6736430/08ffa800-0801-4991-a8b5-fd77cb1e5de7) 4 | 5 | 6 | A Guide for Rails and Web Enthusiasts. Resources here are mapped in a way that you'll have all you need to study, prepare for interviews, or just learn something new! 7 | 8 | - [Druid-on-rails](#druid-on-rails) 9 | - [Interview Prepartions and Job Boards](#interview-prepartions-and-job-boards) 10 | - [Mock Interviews](#mock-interviews) 11 | - [Handbook and Resources](#handbook-and-resources) 12 | - [Job Boards](#job-boards) 13 | - [Learn Ruby](#learn-ruby) 14 | - [Beginner:](#beginner) 15 | - [More Advanced:](#more-advanced) 16 | - [Learn Rails](#learn-rails) 17 | - [Resources](#resources) 18 | - [Channels](#channels) 19 | - [Blogs](#blogs) 20 | - [Podcasts](#podcasts) 21 | - [Misc](#misc) 22 | 23 | 24 | 25 | --- 26 | 27 | # Interview Prepartions and Job Boards 28 | 29 | ### Mock Interviews 30 | 31 | [Hellointerview](https://www.hellointerview.com/) 32 | 33 | [Pramp](https://pramp.com/) 34 | 35 | [Tech Mock Interviews](https://www.techmockinterview.com/) 36 | 37 | [Interview Bit](https://www.interviewbit.com) 38 | 39 | [Interviewing.io](https://interviewing.io/) 40 | 41 | ### Handbook and Resources 42 | 43 | [Tech Interview Handbook](https://github.com/yangshun/tech-interview-handbook) 44 | 45 | --- 46 | 47 | # Job Boards 48 | 49 | [Rails Job Board](https://jobs.rubyonrails.org/) 50 | 51 | [Ruby on Remote](https://rubyonremote.com/) 52 | 53 | --- 54 | 55 | # Learn Ruby 56 | 57 | ### Beginner: 58 | 59 | [The Odin Project](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby) 60 | 61 | [Exercism](https://exercism.org/tracks/ruby/exercises) 62 | 63 | [Ruby Lang Documentation](https://www.ruby-lang.org/en/documentation/quickstart/) 64 | 65 | [Programming Ruby 3.3 (5th Edition)](https://pragprog.com/titles/ruby5/programming-ruby-3-3-5th-edition/) 66 | 67 | ### More Advanced: 68 | 69 | [99bottles by Sandi Metz](https://sandimetz.com/99bottles) 70 | 71 | [Rebuilding Rails](https://rebuilding-rails.com/) 72 | 73 | [Metaprogramming Ruby 2](https://pragprog.com/titles/ppmetr2/metaprogramming-ruby-2/) 74 | 75 | --- 76 | 77 | # Learn Rails 78 | 79 | [Odin Porject - Rails Course](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-on-rails) 80 | 81 | [Upcase by thoughtbot](https://thoughtbot.com/upcase/rails) 82 | 83 | [Rails Tutorial](https://www.railstutorial.org/) 84 | 85 | [Rails Official Guide](https://guides.rubyonrails.org/) 86 | 87 | --- 88 | 89 | # Resources 90 | 91 | ## Channels 92 | 93 | - [Ruby on Rails](https://www.youtube.com/@railsofficial/featured) 94 | - [GoRails](https://gorails.com/) 95 | - [Drifting Ruby](https://www.driftingruby.com) 96 | - [Confreaks](https://www.youtube.com/user/Confreaks) 97 | - [Deanin](https://www.youtube.com/channel/UCUeZ3YgblYkMQt0wJP3OR-Q/featured) 98 | - [SupeRails](https://www.youtube.com/c/SupeRails/featured) 99 | 100 | ## Blogs 101 | 102 | - [Mike Perham](http://www.mikeperham.com/) 103 | - [Schneems](http://www.schneems.com/) 104 | - [Honeybadger Ruby Blog](http://blog.honeybadger.io/ruby/) 105 | - [Thoughtbot - Rails](https://robots.thoughtbot.com/tags/rails) 106 | - [JetBrains Ruby/Rails](https://www.jetbrains.com/ruby/help/rails.html) 107 | - [Rails Forum](https://railsforum.com/) 108 | - [RubyFlow](http://www.rubyflow.com/) 109 | - [Ruby Libhunt](http://ruby.libhunt.com/) 110 | - [FullStory Blog](http://blog.fullstory.com/) 111 | - [Duck Type Labs](http://ducktypelabs.com/) 112 | - [Slack Engineering](https://slack.engineering/) 113 | - [Netflix TechBlog](https://medium.com/netflix-techblog) 114 | - [Makandra Cards](https://makandracards.com/makandra) 115 | 116 | ## Podcasts 117 | 118 | - [Software Engineering Daily](https://softwareengineeringdaily.com/category/podcast/) 119 | - [Thoughtbot's Clean Code](https://thoughtbot.com/upcase/clean-code) 120 | - [Stackoverflow Podcast](https://stackoverflow.blog/podcast) 121 | - [Syntax](https://www.youtube.com/@syntaxfm) 122 | 123 | ## Misc 124 | 125 | - [Papers We Love](https://github.com/papers-we-love/papers-we-love) 126 | - [Google Interview University](https://github.com/jwasham/google-interview-university) 127 | - [Project Guidelines](https://github.com/wearehive/project-guidelines) 128 | - [Test Your Sysadmin Skills](https://github.com/trimstray/test-your-sysadmin-skills) 129 | - [Regexone](https://regexone.com/) 130 | - [Build Your Own X](https://github.com/danistefanovic/build-your-own-x) 131 | --------------------------------------------------------------------------------