When I was setting up Ruby assignment1 this week, I wanted to copy all of the exercises and specs from last quarter and associate them with the assignment for this quarter.
I came up with a pretty nice solution using .attributes which returns a Hash of the existing attributes for a record that I can pass straight to the .create method.
BUT this .attributes includes the id too, so this doesn’t work yet. You can exclude key/value pairs from a Hash using .except. You can provide multiple keys at the same time as well.
This SO answer made me curious what a “polyfill” was so I looked it up.
In web development, a polyfill is code that implements a feature on web browsers that do not support the feature. Most often, it refers to a JavaScript library that implements an HTML5 or CSS web standard, either an established standard (supported by some browsers) on older browsers, or a proposed standard (not supported by any browsers) on existing browsers.
You can use a Proc like this to serve static files.
# config.rumap'/'dopath='/index.html'default_homepage=File.read(path)app=procdo|env|[200,{'Content-Type'=>'text/html'},[default_homepage]]# last argument needs to be an arrayendrunappend
This should ask you to sign in, if you’re not already. Sign in credentials are stored in ~/.gem/credentials. So remove that if you want to “sign out” of rubygems.
In the eternal journey of freeing up more memory, I noticed that the storage management settings on my laptop (MacOS 12) had a new section for “developer cache”.
(not actually my computer)
Not only do I not know what is does, it also was taking up a lotta space!
It turns out all of this “cache” is related to writing code for apple products which is not why I have xcode installed (I just need it for Ruby I think). So deleting the cache is safe to do, but it will keep coming back.
To prevent that from happening, you need to open xcode (which actually made me install something else 😠) and delete all of the simulators.