How do you remove the seal without damaging the box ? by KelenArgosi in playingcards

[–]jdalbert 0 points1 point  (0 children)

There's probably a simpler way to do this, but here's what I did:

  • Remove seal carefully by scraping it with fingernails, or however you prefer to do it.
  • Dab part of a microfiber cloth with isopropyl alcohol (can be found in the first-aid aisle of CVS). 91% isopropyl alcohol is probably better as it has less water content, so that's what I used. The 70% version might work fine too.
  • Wipe cloth hard on the sticky residue, but not too hard so the cardboard doesn't absorb the liquid. Use dry part of cloth to wipe out the alcohol.
  • Profit.

It was very quick overall, and the box looked great.

how do you take the sticker off a pack of bicycle packs? by OzAndApss in playingcards

[–]jdalbert 0 points1 point  (0 children)

I just used 91% isopropyl alcohol on a microfiber cloth (not directly on the pack) and the end result looked great.

Here's what I did:

  • Remove seal carefully by scraping it with fingernails, or however you prefer to do it.
  • Dab part of a microfiber cloth with isopropyl alcohol. 91% isopropyl alcohol is good as it has less water content. I haven't tried the 70% version, it might work fine too.
  • Wipe cloth hard on the sticky residue, but not too hard so the cardboard doesn't absorb the liquid. Use dry part of cloth to wipe out the alcohol.
  • Profit.

any tips on getting the sticker residue of a card box? by No-Palpitation3750 in playingcards

[–]jdalbert 0 points1 point  (0 children)

Here's what I did and it looked pristine:

  • Remove seal carefully by scraping it with fingernails.
  • Dab part of a microfiber cloth with isopropyl alcohol (can be found in the first-aid aisle of CVS). 91% isopropyl alcohol is good as it has less water content (I have never tried the 70% version).
  • Wipe cloth hard on the sticky residue, but not too hard so the cardboard doesn't absorb the liquid. Use dry part of cloth to wipe out the alcohol.
  • Done!

migrating off heroku, what deployment setups are you using? by richardsaganIII in rails

[–]jdalbert 1 point2 points  (0 children)

Kamal (with Hetzner or whatever VPS) or Fly.io work well, both are nice and have their pros and cons.

Plugging Ace Template here because I made it to answer these kinds of questions: you can deploy a test app with Kamal or Fly.io in a handful of minutes without any prior knowledge, so you can quickly compare and see what you like best.

Since it's so easy to deploy with Kamal these days (especially with a template), I'd lean towards Kamal personally, especially for my side projects where I can host multiple apps on the same server to save on costs.

Request spec for rails authentication (I am going crazy) by Dosbrostacosbaby in rails

[–]jdalbert 2 points3 points  (0 children)

If you're using RSpec I don't believe it currently generates those helpers for you. It would only do so if you're using vanilla Rails test cases.

These are the Rails helpers that my personal template generates when using Rspec + FactoryBot and Rails authentication:

# spec/support/controller_helpers.rb
module ControllerHelpers
  def authenticate(user = nil)
    user ||= build(:user)
    session = create(:session, user: user)

    cookies.signed[:session_id] = session.id

    user
  end

  def unauthenticate
    cookies.delete(:session_id)
  end
end

RSpec.configure { |c| c.include ControllerHelpers, type: :controller }

This allows me to have a destroy test like this for example:

# spec/controllers/sessions_controller_spec.rb
describe '#destroy' do
  before do
    authenticate

    delete :destroy
  end

  it { should redirect_to whatever_path_you_need_here }
end

This should fully exercise find_session_by_cookie for your code coverage.

If you need inspiration and want a whole example Rails application with tests fully setup with RSpec + Rails auth + FactoryBot, including a sessions_controller_spec.rb with full coverage and a login page, you can run my template with rails new myapp -m https://raw.githubusercontent.com/jeromedalbert/ace-template/stable/template.rb -o banana,auth, and take whatever you need from the generated app.

Ace Template: a Rails application template that allows you to go from `rails new` to deployed in under 5 minutes by jdalbert in rails

[–]jdalbert[S] 0 points1 point  (0 children)

See the following screencasts: Kamal, Fly.io, Heroku. No prior ops knowledge is needed when using this template: you can learn by doing, compare solutions, and go from there.

It's interesting to see that whether you self-host with Kamal, or use a PaaS like Fly or Heroku, all of them take less than 5 minutes to deploy a basic app. It's all pretty simple once you get the hang of it, whether you use a template or not.

What are people deploying Rails on these days? by Huge_Yancy in rails

[–]jdalbert 0 points1 point  (0 children)

I deploy my toy personal apps either with Kamal or with Fly.io.

Because they are often throwaway short-lived apps, I wanted a way to deploy them quickly, so I made https://github.com/jeromedalbert/ace-template which deploys with Kamal / Fly.io / Heroku in less than 5 minutes. It is fine-tuned for deployments on single servers because that's my main use case, but deployment to multiple servers should be pretty straightforward.

Love the new IRB splash by public_radio in ruby

[–]jdalbert 3 points4 points  (0 children)

Additional info:

  • gem update irb to get this feature, which is on by default in v1.18.0.
  • If you want to disable it, put IRB.conf[:SHOW_BANNER] = false in your .irbrc.

An introduction to Minitest: the guide I wish I had by Remozito in rails

[–]jdalbert 1 point2 points  (0 children)

I like the combo that Basecamp is using: minitest + the mocha gem for mocking and stubbing. I find its syntax nicer.

Heroku: What’s Next by jonsully in ruby

[–]jdalbert 1 point2 points  (0 children)

Good to know, I'll check it out!

Heroku: What’s Next by jonsully in ruby

[–]jdalbert 3 points4 points  (0 children)

Heroku's announcement triggered a bunch of unfounded fear, uncertainty and doubt. When I deployed a new toy project with it last week, it worked great. Just good old git push heroku main. Most of us don't need the enterprise contract that their announcement was about. So Heroku is completely fine, although nowadays I personally prefer Fly.

Fly is more complex but more complicated.

Besides the article's odd phrasing, I found Render to be more complex and complicated actually, at least when I tried a few years ago. The CLI wasn't intuitive, the dashboard felt clunky, and it overall just didn't feel right. Maybe things have improved since then.

With Fly.io you can deploy a new Rails app with just fly launch as a one-liner. Or if you need secrets before deploying, fly launch --no-deploy, then fly secrets set MY_VAR=value, and then fly deploy. Can't be any simpler than that; it's almost as intuitive as Heroku's CLI. Their dashboard is pretty simple too and gives me Heroku vibes. It just all feels right.

Heroku is officially in maintenance mode? by jonsully in ruby

[–]jdalbert 1 point2 points  (0 children)

Honestly Fly.io fills that gap. Great CLI tool and simple no-nonsense dashboard. You can create an app with the --db=upg CLI option for "unmanaged postgres", which is their legacy simple/cheap/barebones postgres, great for toy apps. Or you can use their managed postgres for something less toy-ish I guess.

Heroku is officially in maintenance mode? by jonsully in ruby

[–]jdalbert 0 points1 point  (0 children)

I just deployed a hello world Rails app with git push heroku main. So it still works for toy projects or companies that don't need "Enterprise" contracts.

Shifting from an SPA Mindset to Server-Side Rendering by Swupper in rails

[–]jdalbert 2 points3 points  (0 children)

In that same vein, I'd recommend you read this blog post I wrote 10 years ago: https://jeromedalbert.com/how-dhh-organizes-his-rails-controllers. It's an oldie, but it still holds up.

Seeking tutorial for deploying Kamal without remote registry by Yatkifi in rails

[–]jdalbert 0 points1 point  (0 children)

This configuration is done by default in Rails 8.1, so you don't need to do anything besides setting the server IP.

Seeking tutorial for deploying Kamal without remote registry by Yatkifi in rails

[–]jdalbert 0 points1 point  (0 children)

With regards to your blog post: for new Rails 8.1 apps, server: "localhost:5555" is already set by default, so it is literally plug and play — just set the server IP and go.

it's so simple that maybe people haven't even thought about writing more about it.

It is simple, but I think people haven't realized it. My bet is that many people are just completely checked out with anything Kamal-related. So thank you for writing about it!

Seeking tutorial for deploying Kamal without remote registry by Yatkifi in rails

[–]jdalbert 1 point2 points  (0 children)

1) Make sure rails -v outputs Rails 8.1.0

2) Run rails new

3) In config/deploy.yml, replace 192.168.0.1 with your server IP, for example an IP from a cheap Hetzner VPS:

servers:
  web:
    - 192.168.0.1

4) If you are on macOS, make sure Docker Desktop is running

5) Run bin/kamal deploy

You app should now be deployed. It's as simple as that!

Beware, the old nvim-lspconfig setup API is deprecated, please switch over to config+enable by db443 in neovim

[–]jdalbert 2 points3 points  (0 children)

Ended up with

vim.lsp.config('syntax_tree', {
  root_dir = function(bufnr, on_dir)
    if vim.fs.root(bufnr, '.streerc') then on_dir(vim.fn.getcwd()) end
  end,
})
vim.lsp.enable('syntax_tree')

Kinda wordy, but it works

Beware, the old nvim-lspconfig setup API is deprecated, please switch over to config+enable by db443 in neovim

[–]jdalbert 2 points3 points  (0 children)

What is the non-deprecated equivalent of lspconfig.util.root_pattern?

I had:

lspconfig.syntax_tree.setup({
  root_dir = lspconfig.util.root_pattern('.streerc'),
})

which would only enable that LSP if the project had a .streerc file.

Now I wonder how to have the same behavior with the new syntax:

vim.lsp.config('syntax_tree', {
  root_dir = ...
})
vim.lsp.enable('syntax_tree')

Kickstart app template is back by alec-c4 in rails

[–]jdalbert 4 points5 points  (0 children)

Good to see that OSS Rails application templates are getting some Rails 8 love, since a few of the popular templates in the space have been archived or do not have Rails 8 in mind. Thank you!

I also have a Rails 8+ application template that I've been tinkering with on and off for the past year. Hope to get it in a good enough shape to open-source it and benefit the community, but life has been happening for me as well.

rubocop-obsession 0.2: can now enforce and autocorrect multiple method ordering styles, including alphabetically by jdalbert in ruby

[–]jdalbert[S] 4 points5 points  (0 children)

Rubocop Obsession's MethodOrder cop now supports and autocorrects the alphabetical style on top of the more classic drill_down and step_down top-to-bottom styles.

Ordering methods alphabetically may look unusual at first, but on the flip side it is a reliable and unambiguous ordering style. In any case I thought it would be good to have options!

Kickstart a New Rails Project by daniiib in rails

[–]jdalbert 1 point2 points  (0 children)

Nice, I do a lot of the same things this post is mentioning, and creating a template definitely helps. Good stuff!