This code makes it easy to pluralize words based off of English pluralizing rules.
$ go run main.go
2 balls
1 boy
3 foxes
2 babies
This documents an example of how to offer both PhotoSwipe v5 and Lightbox2 in one project.
PhotoSwipe helps to make the photo clickable, and then it'll zoom for the user and create a gallery, you can call the photo _include
:
Over the past several years, Homebrew has made it continually difficult to install an outdated formula. I'm not quite sure why, but it's been a struggle for developers for the past 7+ years.
However, there is a workaround (however it's not straight-forward). For this example, I'll use ruby-build
:
$ ruby-build --version
ruby-build 20210825
Look for a message like this. If it says that your default branch is behind the upstream's default branch (usually master
), it means there are updates:
If you ever have a string that doesn't play nice with URLs, that's probably because it has spaces, or slashes, or anything like that. So, with this easy method, we can turn that string into a URL-friendly string!
def url_encode(str)
str.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| format('%%%<val>02X', val: m.unpack1('C')) }
end
> url_encode('foo/bar')