- Generate new rails app using
--webpackflag
rails new myApp --webpack=vueNote:
- You can use
--webpack=angularfor angular application and--webpack=reactfor react.
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.jsdiff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644| #!/usr/bin/env bash | |
| # https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
| # https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
| # http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
| # http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
| # http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
| # http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
| # Remove existing downloads and binaries so we can start from scratch. | |
| rm ~/google-chrome-stable_current_amd64.deb |
| # .rubocop.yml | |
| # rubocop config files for Ruby 3.0 / Rails 6+ project | |
| AllCops: | |
| TargetRubyVersion: 3.0 | |
| NewCops: enable | |
| SuggestExtensions: false | |
| Include: |
| config.assets.precompile += [ | |
| # precompile any CSS or JS file that doesn't start with _ | |
| /(^inline[^_\/]|\/[^_])[^\/]*.(js|css)$/, | |
| ... |
| // Restify Server CheatSheet. | |
| // More about the API: http://mcavage.me/node-restify/#server-api | |
| // Install restify with npm install restify | |
| // 1.1. Creating a Server. | |
| // http://mcavage.me/node-restify/#Creating-a-Server | |
| var restify = require('restify'); |
#Simple Authentication with Bcrypt
This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.
The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).
You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault
##Steps
| # ruby script to copy one file to another. | |
| from_file, to_file = ARGV | |
| script = $0 | |
| puts "Copying from #{from_file} to #{to_file}" | |
| # we could do these two on one line too, how? | |
| input = File.open(from_file) | |
| indata = input.read() |
| require 'openssl' | |
| def verify_sign(key, signature, data) | |
| # Verifies with a public key that the data was signed with their private key | |
| pubkey = key.public_key | |
| if pubkey.verify(OpenSSL::Digest::SHA256.new, signature, data) | |
| puts 'the signature is valid' | |
| else | |
| puts 'the signature is invalid' | |
| end | |
| end |