One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.
| #!/bin/bash | |
| chezmoi status --exclude=templates \ | |
| | grep '^DA' \ | |
| | awk '{print $2}' \ | |
| | while read -r file; do | |
| echo "Removing \"$file\" with sync-propagate" | |
| chezmoi chattr +remove "$HOME/$file" | |
| done |
| [color "blame"] | |
| highlightRecent = 234, 23 month ago, 235, 22 month ago, 236, 21 month ago, 237, 20 month ago, 238, 19 month ago, 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226 | |
| [blame] | |
| coloring = highlightRecent | |
| date = human |
| # Put this function to your .bashrc file. | |
| # Usage: mv oldfilename | |
| # If you call mv without the second parameter it will prompt you to edit the filename on command line. | |
| # Original mv is called when it's called with more than one argument. | |
| # It's useful when you want to change just a few letters in a long name. | |
| # | |
| # Also see: | |
| # - imv from renameutils | |
| # - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste) |
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| require "csv" | |
| STDOUT.sync = STDERR.sync = true | |
| gemfile do | |
| source "https://rubygems.org" | |
| gem "http" |
| # @see https://docs.aws.amazon.com/ja_jp/AmazonCloudFront/latest/DeveloperGuide/LocationsOfEdgeServers.html | |
| # @see https://morizyun.github.io/ruby/rails-controller-get-ip.html | |
| # @see https://dev.classmethod.jp/cloud/aws/get-ec2-public-ip-range-by-powershell/ | |
| # @see https://github.com/rails/rails/blob/c81af6a/actionpack/lib/action_dispatch/middleware/remote_ip.rb#L112-L150 | |
| Rails.application.configure do | |
| ip_ranges_res = Faraday.get('https://ip-ranges.amazonaws.com/ip-ranges.json') | |
| ip_ranges = JSON.parse(ip_ranges_res.body) | |
| cloudfront_ips = ip_ranges['prefixes'].select { |v| v['service'] == 'CLOUDFRONT' }.map { |v| IPAddr.new(v['ip_prefix']) } + | |
| ip_ranges['ipv6_prefixes'].select { |v| v['service'] == 'CLOUDFRONT' }.map { |v| IPAddr.new(v['ipv6_prefix']) } |
One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.
TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.
If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)
A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/
The reason to avoid JWTs comes down to a couple different points:
| while(true) do | |
| begin | |
| print '> ' | |
| input = STDIN.readline.chop | |
| output = eval(input) | |
| puts "=> #{output}" | |
| rescue StandardError => e | |
| puts "Error: #{e.message}" | |
| end | |
| end |
| Gemfile | |
| gem 'paper_trail' | |
| gem 'diffy' | |
| gem 'activerecord-diff' | |
| # view | |
| = title "Logs" |
| def fill_stripe_elements(card) | |
| using_wait_time(15) { within_frame('stripeField_card_element0') do | |
| card.to_s.chars.each do |piece| | |
| find_field('cardnumber').send_keys(piece) | |
| end | |
| find_field('exp-date').send_keys("0122") | |
| find_field('cvc').send_keys '123' | |
| find_field('postal').send_keys '19335' | |
| end } |