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.
- there are command-line options which you can add to bash scripts, can be added in the header like
#!/bin/bash -e set -xis very useful while writing shell scripts. It echos commands being run (even in for loops) which helps in debugging. Put this at the top of script file, and see the magic!- http://jsnice.org/ not a TIL, but lost and found it only today. This is a reverse tool that can be run on minified JS to get some more human readable ouput
- You can scope relations like
has_many,has_oneandbelongs_to. Eg:has_one :policy, -> { where active: true } - We can make use of ActiveRecord's unscoped method to accept a blocks, such that we can obtain associations bypassing the default scope on the associations.
- mock moment using jest http://www.bambielli.com/til/2018-01-07-mocking-constructors/
- We can make use of Set instead of an Array in Ruby when we would like to create sequences without duplicates and also can be used to compare two sets disregarding order as compared to array for which order of elements matter.
- ActiveModel Boolean type inlcudes rules for coersion to handle user input appropriately. We can make use of this when ever we would need to do explicit type casting on user input. https://github.com/rails/rails/blob/47eadb68bfcae1641b019e07e051aa39420685fb/activemodel/lib/active_model/type/boolean.rb
- active support has an unordered map like structure https://apidock.com/rails/ActiveSupport/OrderedHash, but it is actually called ordered hash (shrug)
- Multiple ways to read files in golang explained - http://kgrz.io/reading-files-in-go-an-overview.html
- When using docker-compose and when in doubt that containers are getting cached, pass
--buildoption. Works like charm - chrome://net-internals
- use chrome(v65 and above) local overrides to modify a webpage's assets and store on your local which will be loaded everytime you open the website - https://www.youtube.com/watch?v=UOn0b5kn3jk
- If you have a dimple, it's a muscle atrophy - basically your muscle doesn't work
- Use AbortController to cancel the promise.
/code
const controller = new AbortController();
const signal = controller.signal;
// pass this signal as option in your fetch request
fetch(url, {signal}).then(...).catch(...)
// now you can reject the above promise by calling abort like this
signal.abort()
//promise will get rejected with error "AbortError" - preloading data for custom sql,
profiles = Profile.find_by_sql(sql_query)
ActiveRecord::Associations::Preloader.new.preload(profiles, :user)
Some more stuff here http://cha1tanya.com/2013/10/26/preload-associations-with-find-by-sql.html - rendering templates outside of controller "SomeController.render :index, formats: :csv, locals: { users: users }"
- We can specify integrity and crossorigin on link and script tags. More here https://hacks.mozilla.org/2015/09/subresource-integrity-in-firefox-43/
- https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden Looks like this attribute can be used to preload content, or am I wrong?
Showing page 36 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.