- Oct 2024
- Sep 2024
-
-
github.com github.com
-
Looks well-written, but probably not needed in a Rails project, which already has ActiveSupport for dealing with duration and periods
Tags
Annotators
URL
-
-
-
Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.
Tags
Annotators
URL
-
-
github.com github.com
-
drip engine for managing, creating, and performing scheduled messages sequences
Tags
Annotators
URL
-
-
-
Looks really nice. May switch to this from Memoist. This alt is much more configurable.
Tags
Annotators
URL
-
-
github.com github.com
-
mount IndexController do # all methods will be mounted automatically, it's just an example of refinement get '/hello', :hello_world end
-
-
-
.time {|timer = Timer.new.start| ... } ⇒ Object Takes a block and returns the total time it took to execute.
-
-
socketry.github.io socketry.github.io
- Dec 2023
- Sep 2023
- Dec 2022
-
github.com github.com
-
Dilemma: Do I use this unofficial library with its really nice idiomatic API or the official library (https://github.com/mailgun/mailgun-ruby) with its inferior API?
I wish this one was still/better maintained because I'd much rather use this API, like:
@mailgun.lists.create "devs@your.mailgun.domain" @mailgun.lists.list @mailgun.lists.find "devs@your.mailgun.domain"
but it's not maintained, and looks like it doesn't have the word
events
in the source at all, so it's missing any way to use the Events API. :(
-
- Nov 2022
-
www.honeybadger.io www.honeybadger.io
-
Until now, we had a lot of code. Although we were using a plugin to help with boilerplate code, ready endpoints, and webpages for sign in/sign up management, a lot of adaptations were necessary. This is when Doorkeeper comes to the rescue. It is not only an OAuth 2 provider for Rails but also a full OAuth 2 suite for Ruby and related frameworks (Sinatra, Devise, MongoDB, support for JWT, and more).
-
-
gitlab.com gitlab.com
Tags
Annotators
URL
-
- Oct 2022
-
-
Note that one extra type that is accepted by convention is the Boolean type, which represents both the TrueClass and FalseClass types.
-
- Jul 2022
-
stackoverflow.com stackoverflow.com
-
Create a new controller to override the original: app/controllers/active_storage/blobs_controller.rb
Original comment:
I've never seen monkey patching done quite like this.
Usually you can't just "override" a class. You can only reopen it. You can't change its superclass. (If you needed to, you'd have to remove the old constant first.)
Rails has already defined ActiveStorage::BlobsController!
I believe the only reason this works:
class ActiveStorage::BlobsController < ActiveStorage::BaseController
is because it's reopening the existing class. We don't even need to specify the
< Base
class. (We can't change it, in any case.)They do the same thing here: - https://github.com/ackama/rails-template/pull/284/files#diff-2688f6f31a499b82cb87617d6643a0a5277dc14f35f15535fd27ef80a68da520
Correction: I guess this doesn't actually monkey patch it. I guess it really does override the original from activestorage gem and prevent it from getting loaded. How does it do that? I'm guessing it's because activestorage relies on autoloading constants, and when the constant
ActiveStorage::BlobsController
is first encountered/referenced, autoloading looks in paths in a certain order, and finds the version in the app'sapp/controllers/active_storage/blobs_controller.rb
before it ever gets a chance to look in the gem's paths for that same path/file.If instead of using autoloading, it had used
require_relative
(or evenrequire
?? but that might have still found the app-defined version earlier in the load path), then it would have loaded the model from activestorage first, and then (possibly) loaded the model from our app, which (probably) would have reopened it, as I originally commented.
-
-
github.com github.com
-
Compared to https://github.com/aki77/activestorage-validator, I slightly prefer this because - it has more users and has been battle tested more - is more flexible: can specify
exclude
as well asallow
- has more expansive Readme documentation - is mentioned by https://github.com/thoughtbot/paperclip/blob/master/MIGRATING.md#migrating-from-paperclip-to-activestorage - mentions security: whether or not it's needed, at least this makes extra attempt to be secure by using external tool to check content_type; https://github.com/aki77/activestorage-validator/blob/master/lib/activestorage/validator/blob.rb just usesblob.content_type
, which I guess just trusts whatever ActiveStorage gives us (which seems fair too: perhaps this should be kicked up to them to be their concern)In fact, it looks like ActiveStorage does do some kind of mime type checking...
activestorage-6.1.6/app/models/active_storage/blob/identifiable.rb
``` def identify_without_saving unless identified? self.content_type = identify_content_type self.identified = true end enddef identify_content_type Marcel::MimeType.for download_identifiable_chunk, name: filename.to_s, declared_type: content_type end
```
Tags
Annotators
URL
-
- Mar 2022
-
rom-rb.org rom-rb.orgROM1
-
mainstream way: ActiveRecord
-
- Feb 2022
-
github.com github.com
-
biggs is a small ruby gem/rails plugin for formatting postal addresses from over 60 countries.
-
- Jul 2021
-
stackoverflow.com stackoverflow.com
-
I think that it's nonsense not to have a method that just gives -1 or +1. Even BASIC has such a function SGN(n). Why should we have to deal with Strings when it's numbers we want to work with. But's that's just MHO.
-
- Jun 2021
-
www.gertgoet.com www.gertgoet.com
-
Note: as for setting boolean variables: not only are true/false and 0/1 acceptable values, but also T/F and on/off. Thanks, coercible!
-
-
stackoverflow.com stackoverflow.com
-
Or if you're looking for a core extension that adds this to the Array class, I'd recommend the facets gem (require 'facets/array/average'). Then you can just do array.average. And, from looking at the source, it turns out they do the exact same thing as the instance_eval approach above. The only difference is that it's implemented as a method—which of course already has self pointing to itself—instead of a block): def average; return nil if empty?; reduce(:+) / length.to_f; end Main advantage of this is that it's even more concise/readable and it handles the empty? case.
-
- Apr 2021
-
github.com github.com
Tags
Annotators
URL
-
- Mar 2021
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
In fact, I'm only here because it seems like something one would 'expect' ruby already to do.
-
-
github.com github.com
-
github.com github.com
-
github.com github.com
Tags
Annotators
URL
-
- Feb 2021
-
dry-rb.org dry-rb.org
-
trailblazer.to trailblazer.to
-
Trailblazer is an architectural pattern that comes with Ruby libraries to implement that pattern.
-
-
github.com github.com
-
github.com github.com
- Jun 2020
-
github.com github.com
-
github.com github.com
- May 2020
-
github.com github.com
- Apr 2020
-
github.com github.com
-
github.com github.com
-
github.com github.com
-
github.com github.com
Tags
Annotators
URL
-
-
docs.seattlerb.org docs.seattlerb.org
-
minitest doesn't reinvent anything that ruby already provides, like: classes, modules, inheritance, methods. This means you only have to learn ruby to use minitest and all of your regular OO practices like extract-method refactorings still apply.
-
- Mar 2020
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
-
This looks good but https://github.com/jonahb/akismet looks better maintained
-
-
github.com github.com
-
github.com github.com
- Feb 2020
-
github.com github.com
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
-
-
If you like the straight forward and effective nature of Strong Parameters
-
-
github.com github.com
Tags
Annotators
URL
-
- Dec 2019
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
Tags
Annotators
URL
-