ActiveRecord::Base.connection to console config block. TILs
Fueling Curiosity, One Insight at a Time
At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.
- Rails console does lazy connection to database and this behaviour can be changed with by adding
- "localization" referred as "l10n", and "internationalization" referred as "i18n". cause,
l10n => "l" in between 10chars(o, c, a, l, i, z, a, t, i, o) and then "n"
i18n => "i" in between 18chars and then "n"
Also Globalization (g11n), Localizability (l12y).
I didnt knew, never noticed, and I feel stupid now :P [...Array(100).keys()]will return a range from 0 to 100- long read on load balancing https://blog.envoyproxy.io/introduction-to-modern-network-load-balancing-and-proxying-a57f6ff80236
- more info on proxy javascript objects here https://docs.microsoft.com/en-us/scripting/javascript/reference/proxy-object-javascript
- in es6 you can now proxy your object's operation like get, set etc. All you need to do it create a proxy on a object like
const proxyObj = new Proxy(initialObj, handler)the initial object is the object that you want to create proxy for and handler object is the place where you override object's method like get and set. - about ActiveSupport::Notifications there is a railscasts on it http://railscasts.com/episodes/249-notifications-in-rails-3
- In javascript generally if you reduce an array it starts from 0th element and goes till the end but if you want to run the reduce from right to left of an array i.e. start from last element and go till the first element use
arr.reduceRight - In order to know hierarchy of translations, print defaults here https://github.com/rails/rails/blob/v5.1.4/activemodel/lib/active_model/errors.rb#L405 and see the magic!
flash.nowin rails, which allows you to have flash messages which does not persists across subsequent action unlike regularflashi.e it sets a flash message which is available only to the current action and not for next. http://api.rubyonrails.org/v5.1/classes/ActionDispatch/Flash/FlashHash.html#method-i-now- [RealWorld](https://github.com/gothinkster/realworld) is a project that curates a list of implementations of frontends and backends in different frameworks for the same application spec . This is a great way to understand how to build non-trivial features when getting started with a new framework.
- ActiveRecord Query method - none. It returns a chainable relation with zero records.
Post.none => #<ActiveRecord::Relation []> - active record inspect method is invoked to log the active record collection object to the rails console which by default limits the query by 11 but does not actually limit the query being executed.
- Firefox exposes
about:crashesurl where one can see history of crash reports. Clicking on each crash report takes to mozilla website where one can see crash details - we can tell the browser how to execute the script. By default, browser runs the script immediately by pausing HTML parsing. Else you can specify async or defer with the script tag to either run script asynchronously or defer it until HTML is parsed.
- if you are using file-loader with webpack to process your assets and want to serve images from cdn you need to pass that cdn url in `publicPath: '<cdn-url>'
- when using webpack-uglify to minify your code if you face a situation where your build fails with syntex error try setting
"uglify-js": truethis will run all the transformations, however you can use"useBuiltIns": truewith that option to only include polyfills for your target browsers
Showing page 38 of 42
Your competitors are already using AI. The question is how fast you want to unlock the value.
Don't know where to start?
AI is everywhere but it's unclear which investments will actually move your metrics and which are expensive experiments.
Your data isn't ready
Most AI projects fail at the data layer. Pipelines, quality, access all need work before LLMs can deliver value.
Internal teams are stretched
Your engineers are shipping product. They don't have capacity to also become AI specialists with production-grade experience.
Legacy systems block everything
Aging, undocumented codebases make AI integration slow, risky, and expensive. They need to move first.
Don't worry. We've got you covered.
Start with the audit.