ashwanikumarjha
Fri Mar 01 2024
While exploring a lengthy code file, we often need to see the available properties and methods without diving into their implementation. In VS Code, this is quite easy with "Fold Level 1" functionality. This feature collapses the code to display only the top-level structures, which makes it easier to understand the file's architecture without getting into the details.
To Use Fold Level 1:
- Open Command Palette:
Ctrl+Shift+P
(Windows) orCmd+Shift+P
(macOS). - Select
Fold Level 1
: Now, only the main parts of our code will be visible. #vs-code, #coding
soniya.rayabagi
Thu Feb 29 2024
Migration of a Repository from GitLab to GitHub:
- Clone the GitLab Repository Locally
git clone <GitLab-repository-URL>
cd <repository-name>
- Add the GitHub Repository as a Remote
git remote add github <GitHub-repository-URL>
- Resolve any merge conflicts that may arise using rebase after pull
git pull github main
- Push from your local repository to the GitHub repository
git push github main
giritharan
Tue Feb 27 2024
Resolving blocked host:
The Blocked Host is a new feature of Rails 6. To resolve the Blocked Host error in rails, add `config.hosts.clear` to `config/environments/development.rb` in your Rails project. This disables the functionality in the development environment, allowing requests from ngrok.
#host-block-issue, #rails
sujay
Mon Feb 26 2024
Extract the source code of the gem to a local directory by using the command gem unpack GEMNAME
.
satya
Mon Feb 26 2024
Setup Tailscale
in local device and serve your localhost
- Intsall tailscale from https://tailscale.com/download for your device.
- Sign up and follow the steps so that your device gets connected.
- Open your terminal and download
tailscale
CLI usingbrew install tailscale
- Run
tailscale serve 3000
(you might get some warning regarding client and server version mismatch) - It will say
Serve is not enabled on your tailnet.
and ask you to visit<https://login.tailscale.com/f/serve?node=><node-id>
- In that link enable the option , and that's it , it will serve your port 3000 successfully. #tailscale , #devops
satya
Fri Feb 23 2024
While changing a column type from one type to another and running rails db:migrate
, it will throw the below error
PG::DatatypeMismatch: ERROR: column "tags" cannot be cast automatically to type jsonb
HINT: You might need to specify "USING tags::jsonb".
above error ^ because i was converting tags
field from type string
to jsonb
so in order to fix this we have to mention the USING tags::jsonb
and cast the type.
class ChangeTagsToJsonbInTils < ActiveRecord::Migration[7.0]
def change
change_column :tils, :tags, 'jsonb USING CAST(tags AS jsonb)'
end
end
#migration, #database, #rails
soniya.rayabagi
Thu Feb 22 2024
Create a PostgreSQL Database in Docker .
Step 1:
Download the latest version of the Postgres image :
docker pull postgres
Step 2:
Create and Run Postgres Container :
docker run -d --name <container_name> -p 5432:5432 -e POSTGRES_PASSWORD=<password> postgres
Step 3:
Verify Executing Container :
docker ps
Step 4:
Interact with Executing Container :
docker exec -it <container_name> bash
Step 5:
Connect to Postgresql Database Server :
psql -h localhost -U postgres
Step 6:
Create Postgresql Database :
CREATE DATABASE <database_name>;
\l
Step 7:
Establish a connection with database :
\c <database_name>
Step 8:
Create Database User :
CREATE USER <user_name> with PASSWORD <password>;
Step 9:
Exit :
\q
#devops #docker
satya
Thu Feb 22 2024
In a typical Rack middleware setup, the call
method handles the initial request and generates a response, but it does not control subsequent redirects initiated by external services. If an external service, such as Slack's OAuth, triggers additional redirects after your application responds, modifying headers for those redirects within the same call
method may not be directly achievable. Handling subsequent redirects may require alternative approaches, such as additional middleware or different parts of your application's code.
#rails , #rack , #middleware
satya
Tue Feb 20 2024
test your gem locally before publishing.
• STEP 1 - cd into your gem directory and run gem build your-gem.gemspec
• STEP 2 - in the same directory then run gem install ./your-gem-<version>.gem
(<version> will be replaced by the current version of your gem)
• STEP 3 - Now cd into your project where you want to install this gem.
• STEP 4 - Open Gemfile and add gem 'your-gem', path: '/path/to/your-gem'
(Replace /path/to/your-gem
with the actual path to your gem.
#ruby-gems , #rails
TIP: you can get your path by running pwd
in your terminal where you have opened your gem
file.
giritharan
Mon Feb 19 2024
Fly Secret Value Displaying Feature:
We can able to see Fly secrets values from terminal
. From the Dashboard of fly we can't able to the secret value. But from the terminal we can able to the see secret value
.
For that we have use below command:
• First Go the project in terminal and enter the fly ssh console
. It redirects you to the fly application in remote.
• Then you can see the what value you want using echo command. Ex: echo $DATABASE_URL
. After entered like this it will display what is the value of the key. Likewise you can place what are ever key want to see.
Showing 13 to 15 of 66 results