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.
Satya
setup tailwind css without using node.js The below setup is for macOS arm64
./tailwindcss init // this will create tailwind.config.js file
Step3 Create input.css file and import the required tailwind base, components & utilities
Step4
Code
./tailwindcss -i input.css -o output.css --watch // this will generate a output.css file, so make sure to link it in your root file
For production add the tailwind watcher command with --minify flag
Code
./tailwindcss -i input.css -o output.css --minify
Hilda
ChatGPT 4.0 has a limit of 40 messages per 3 hours while using some of the custom GPTs like DALL·E
Soniya Rayabagi
touch filename : Used to create an empty file . git remote : The command is used to manage remote repositories. git reset HEAD~1 : Removes the most recent commit from the current branch without modifying the working directory. git pull origin branch_name : Fetches changes from the specified branch (branch_name) on the origin remote repository.
Sujay
Activerecord validations & callbacks are not called when upsert_all or insert_all are used. They will be directly converted to raw sql queries and executed
1. Make sure you have the flyctl command-line tool installed.
2. Open a terminal and navigate to the root directory of your Rails app.
3. Launch a new https://fly.io|fly.io application by running the following command: flyctl launch
This command will guide you through the process of setting up your https://fly.io|fly.io application. You'll be prompted to provide a name for your app and select the organization you want to associate it with. Refer below.
Ruby
Creating app in ~/list Scanning source code Detected a Rails app ? Choose an app name (leave blank to generate one): list ? Select Organization: John Smith (personal) ? Choose a region for deployment: Ashburn, Virginia (US) (iad) Created app list in organization personal Admin URL: https://fly.io/apps/list Hostname: list.fly.dev Set secrets on list: RAILS_MASTER_KEY ? Would you like to set up a Postgresql database now? Yes For pricing information visit: https://fly.io/docs/about/pricing/#postgresql-clu ? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk Creating postgres cluster in organization personal . . . Postgres cluster list-db is now attached to namelist ? Would you like to set up an Upstash Redis database now? Yes ? Select an Upstash Redis plan Free: 100 MB Max Data Size Your Upstash Redis database namelist-redis is ready. . . . create Dockerfile create .dockerignore create bin/docker-entrypoint create config/dockerfile.yml Wrote config file fly.toml Your Rails app is prepared for deployment. Before proceeding, please review the posted Rails FAQ: https://fly.io/docs/rails/getting-started/dockerfiles/.
4. Once the launch is complete, you can deploy your Rails app to https://fly.io|fly.io by running the following command: flyctl deploy
This command will build a Docker image of your Rails app and deploy it to https://fly.io|fly.io. It may take a few minutes to complete the deployment process.
5. After the deployment is finished, you'll see a message indicating that your app has been deployed successfully. It will also display the URL where your app is accessible.
You can use following cmd to open app. fly apps open
That's it! Your Rails app is now running on https://fly.io|fly.io. You can access it using the provided URL.
6. If you make any changes to your app, you can redeploy it by running following command again. flyctl deploy
Sachin KabadiSystem Analyst
To install https://fly.io|fly.io on macOS using Homebrew and authenticate with flyctl, you can follow these steps:
1. Open a terminal on your macOS machine.
2. Install Homebrew if you haven't already. Run the following command in the terminal: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3. Once Homebrew is installed, you can use it to install flyctl. Run the following command in the terminal: brew install superfly/tap/flyctl
4. After the installation is complete, you can authenticate with flyctl using the auth login command. Run the following command in the terminal: flyctl auth login
This will open a browser window where you can log in with your https://fly.io|fly.io account credentials. Once you log in, the authentication token will be saved on your machine.
5. After successful authentication, you can start using flyctl commands to manage your https://fly.io|fly.io resources.
That's it! You have now installed https://fly.io|fly.io on your macOS machine using Homebrew and authenticated with flyctl.
Sachin KabadiSystem Analyst
Install Tailwind CSS with Ruby on Rails
1. Create your project
Code
rails new my-project cd my-project
2. Install Tailwind CSS
Code
rails tailwindcss:install
This will generate tailwind.config.js file in the /config directory.
3. Configure your template paths Add the paths of all your template files to your /config/tailwind.config.js file.
4. Add the Tailwind directives to your CSS Add the @tailwind directives for each of Tailwind's layers to your application.tailwind.css file located in the ./app/assets/stylesheets directory.
In Dart, JSArray<Object> and ConstantStringMap<String, Object> are part of the dart:js library, which is used for interoperability between JavaScript and Dart. They provide ways to interact with JavaScript objects and arrays within Dart code.
1. JSArray<Object>: This represents a JavaScript array. It extends Dart's List class and allows us to interact with JavaScript arrays as if they were Dart lists. This means we can use methods like add, remove, length, etc., on a JSArray<Object> instance. This makes it easier to work with JavaScript arrays in Dart code. 2. ConstantStringMap<String, Object>: This represents a constant JavaScript object. Unlike JSArray<Object>, which allows us to modify the JavaScript array, ConstantStringMap<String, Object> is read-only. This means we can access properties of the JavaScript object, but we can't modify them. This is useful when we want to ensure that the JavaScript object isn't accidentally modified by Dart code. Example:
journalctl command can be used to check the system log on the server. you can use the --since and/or --until options to specify a time range. eg: • To filter log between 1st Jan 2024 to 10th Jan 2024: journalctl --since "2024-01-01" --until "2024-01-10" • To filter log between 5am to 6am for 1st Jan 2024: journalctl --since "2024-01-01 5:00:00"" --until "2024-01-10 6:00:00""
Ayush
While creating contracts using Dry Gem it is important to keep in mind that if a validation rule is independent of a key from schema then schema will not process those keys before executing the validation rule.
For Example
Ruby
class RoomAvailabilityFormContract < Dry::Validation::Contract params do required(:date_from).filled(:string) required(:date_to).filled(:string) end rule(:date_to) do date_from = Date.parse(values[:date_from]) date_to = Date.parse(values[:date_to]) if date_to && date_from && date_to <= date_from key.failure('date_to must be ahead of date_from') end endend
Our expectation from above contract will be if either date_to or date_from is missing in the schema the rule should not be executed and error should be caught while schema processes the keys which are date_to and date_from
But it will only work in case of date_from because the validation rule is dependent on the date_from key so if we have date_to as nil the rule will still be executed and might cause other errors like in our trying to parse nil value which does not fulfills the purpose of this gem.
To not get into such errors we should make sure that the validation rules are dependent upon the keys that are validated in schema
So the fix in above code will be to include date_to
Ruby
rule(:date_from, :date_to) do date_from = Date.parse(values[:date_from]) date_to = Date.parse(values[:date_to]) if date_to && date_from && date_to <= date_from key.failure('date_to must be ahead of date_from') end end
now before implementing the rule the schema will first validate both the keys and throw error if the values are not abiding to the schema
Satya
we can raise error using to_raise method inside our webmock in the spec file. for example:
In a web app, certain non-code files like EJS templates are not automatically included in the production build, causing runtime errors as the application can't locate these files.
NestJS provides a built-in solution through the nest-cli.json configuration file. This file allows us to specify non-TypeScript assets to be included in the build process. By defining a pattern for the files and specifying the output directory, we can ensure these files are copied to the correct location during the build process.
In frameworks that do not provide a built-in solution for including non-TypeScript files in the build process, we can use external tools to handle this. For example, in Hapi.js, we can use cpx to copy these files during the build process.
Soniya Rayabagi
Setting Up SSH Authentication in Git for GitHub
1. Generate SSH Key Pair: ssh-keygen -t rsa -b 4096 -C "<mailto:[email protected]|[email protected]>" cat ~/.ssh/id_rsa.pub 2. Start the SSH Agent: eval "$(ssh-agent -s)" 3. Add SSH Key to the SSH Agent: ssh-add ~/.ssh/id_rsa 4. Add SSH Key to GitHub Account: 5. Test SSH Connection to GitHub: ssh -T <mailto:[email protected]|[email protected]> 6. Output: Hi soniyaraibagi! You've successfully authenticated, but GitHub does not provide shell access.
Nisanth
Encountered an issue with a Docker container image, preventing to destroy the vagrant environment using vagrant destroy. The error message indicated:
Code
An action 'up' was attempted on the machine 'default',but another process is already executing an action on the machine.Vagrant locks each machine for access by only one process at a time.Please wait until the other Vagrant process finishes modifying thismachine, then try again.
To resolve this issue, I used the following steps: 1. Opened the “Activity Monitor” to identify the PID (Process ID) associated with the Vagrant Docker container. 2. Executed the following command in the terminal to forcefully terminate the Vagrant process: kill -9 PID
This action allowed me to overcome the locking issue and proceed with the destruction of the Vagrant environment successfully.
Mahesh BhosleDevOps Engineer
The web-socket APIs in AWS API Gateway service use different integrations to send the incoming requests to backend service. Two of them being HTTP and HTTP_PROXY. key difference lies in how the communication between API Gateway and the backend service is handled. HTTP integration involves translating WebSocket requests into HTTP requests, while HTTP proxy integration forwards WebSocket requests directly to the backend service without modification
Mahesh BhosleDevOps Engineer
While using tfenv tool for using multiple terraform version, we can use TFENV_ARCH variable to set the system architecture. This helps a lot when we need to use terraform amd64 binary on the arm64 device. eg: to use amd64 binary for terraform 0.14.0, we can use the following command: TFENV_ARCH=amd64 tfenv install 0.14.0
Ashwani Kumar JhaSenior System Analyst
In Next.js, we can organize our routes into groups without affecting the URL path. This can be done by wrapping a folder's name in parentheses, like (group).
Let's say we have an e-commerce application, we might have different sections like "electronics", and "clothing". Even though these sections have different URLs, we can group them in our code using route groups.
In this structure, the URL paths will be /electronic1, /electronic2, /clothing1, /closthin2 etc, regardless of the category they belong to.
While route groups don't affect the URL structure, they still allow us to create different layouts for each group by adding a layout.js file inside their folders.
Iffyuva
In order to check DNS settings and the resolved IPs, visit about:networking#dns in Firefox
Satya
we can interact with browser events like click on a element in rails using Stimulus Make sure you have @hotwired/stimulus installed . Generate a stimulus controller by running the below commands.
Here , say my controllerName is tooltip , this will create a controller called tooltip_controller.js in app/javascripts/controllers directory & also link the file in app/javascripts/controllers/index.js .
For eg: my functionality is i want to toggle the tooltip visibility so the controller code will look like this
JavaScript
import { Controller } from "@hotwired/stimulus";// Connects to data-controller="tooltip"export default class extends Controller { connect() {} toggleToolTip(event) { event.preventDefault(); this.element.lastElementChild.classList.toggle("hidden"); }}
And in your view file we need to wrap our parent div with an attribute called data-controller="tooltip" so the code will look like this
so here on click of the image it will toggle the tooltip container , if you take a close look on -> data: { action: "click->tooltip#toggleToolTip" } this is simply saying perform the click action on tooltip controller using toggleToolTip method defined above.
Showing page 18 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.