teleren/devto huggingface dataset:
clsx for Rails views
Tags: rails, ruby, css, opensource
Published: 2024-03-03 19:25:38

Hey, fellow Rubyists!

Have you ever found yourself wrestling with conditional class strings in your Rails views? Juggling string interpolation, conditional logic, and array manipulation to apply a class or two conditionally? It's like trying to thread a needle in a hurricane. Well, fret no more! Say hello to [clsx-rails](https://github.com/svyatov/clsx-rails), the newest member of the Ruby gems family, here to make your life a tad bit easier.

Inspired by the simplicity of the [clsx](https://github.com/lukeed/clsx) npm package, `clsx-rails` is your Rails view's new best friend. It's a tiny helper with a mighty purpose: to streamline how you handle CSS classes, making your code cleaner, more readable, and, let's be honest, more elegant.

## Why `clsx-rails`?

Because we've all been there:

```erb
<div class="<%= ['foo', 'bar', condition ? 'baz' : nil].compact.join(' ') %>">
  Hello, Rails world!
</div>
```

It gets the job done, but it's about as graceful as a giraffe on ice skates. With `clsx-rails`, you can turn that mess into a one-liner marvel:

```erb
<div class="<%= clsx(:foo, :bar, baz: condition) %>">
  Hello, Rails world!
</div>
```

## Usage Examples

Whether it's a string, a hash, or an array, `clsx-rails` handles them all, even nesting them like Russian dolls if that's your jam. It even eliminates any duplicates while at it! And for those who like their code like their coffee—short and strong - there's the `cn` alias.

```ruby
# Variadic strings
cn('this', true && 'is', 'awesome')
# => 'this is awesome'

# Hashes with truthy/falsy values
cn(foo: true, bar: false, baz: condition)
# => 'foo baz' (assuming the condition is true)
```

Although not advised, it can handle any level of "complexity":

```ruby
clsx(
  [[[['a'], 'b']]],
  { a: 1, b: 2 },
  [1, 2, 3, 4],
  { [1, 2, { %w[foo bar] => true }] => true }
)
# => 'a b 1 2 3 4 foo bar'
```

You can find more details and usage examples in the [repo](https://github.com/svyatov/clsx-rails).

## Why It's Useful

* Keeps your views DRY and readable.
* Reduces the mental overhead of handling conditional classes.
* It's like giving your views a neat little toolbelt for CSS class manipulation.

So, if you're tired of the conditional class string chaos and want to add some syntactic sugar to your Rails views, give [clsx-rails](https://github.com/svyatov/clsx-rails) a whirl. Your views will thank you, and who knows, you might find yourself with a bit more time for coffee breaks :)

Happy coding!
Portfolio Website / Bible App - Devlog #6
Tags: webdev, beginners, react, learning
Published: 2024-03-03 19:20:38

Accomplished:
Conditional rendering of verses.
Check for duplicate reference before adding.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgabs096uutqq1496eh8.png)
View Verses
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mp89oiga8tneo70s5afq.png)

To do:
Maybe after clicking the buttons should shrink,
Styling,
Implement form handling to Add Verse reference, which POSTs object to backend Springboot server to add to DAO / Object array (temporary).
My Virtual Internship Journey at Oasis Infobyte as a Web Developer: A Month of Learning and Growth.
Tags: html, javascript, tailwindcss, webdev
Published: 2024-03-03 18:50:12

Hii there!
I haven't posted anything in a while. Excited to tell you all that I've been in a Virtual and Certificate based internship with Oasis Infobyte. I received my offer letter on 3rd February for which I was waiting for. Here's my Offer Letter :

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oa7mtzn80q8lv3pe286s.png)

It was an amazing journey where I had to complete few projects which were based on levels.
My internship experience at Oasis Infobyte has been a transformative journey filled with learning, growth, and discovery. Every aspect of this experience has contributed to my personal and professional development. 
I look forward to applying the skills and knowledge gained during my internship to future endeavors and contributing to the ever-evolving world of web development and design.

Thank You!
Investigating the Adoption of Domain Design in Software
Tags: programming, testing, blockchain
Published: 2024-03-03 18:41:18

 
[https://youtu.be/QQ7O5dNyx78?si=TQEdcd-XrQOOB9_w](https://youtu.be/QQ7O5dNyx78?si=TQEdcd-XrQOOB9_w ) 
check out my video on YouTube:)
Swagger Export from .NETCore
Tags: aspnet, swagger, apidoc, aspnetswagger
Published: 2024-03-03 18:39:32

If you have an ASP.NET Web API project. Chances are you are using `Swashbuckle.AspNet.Core` to generate swagger documentation for the application.

Now if you need some way to export the swagger api documentation during your build for CI/CD or any other things, this is for you.

## Pre-requisite

I am assuming you already have a service from which you can access the swagger JSON/UI. 

### Generating Swagger on Build

#### set up dotnet-tools
- Run `dotnet new tool-manifest` at root of your project.
- it will create a `.config` directory with `dotnet-tools.json` in it. this file will have references to the packages that you've installed.
- install swashbuckle cli. run `dotnet tool install --local Swashbuckle.AspNetCore.Cli`

#### add post build step

- in the project csproj file, add a new post build step. 
- add step
```xml
<Target Name="SwaggerGenerate" AfterTargets="PostBuildEvent">
    <Exec Command="dotnet tool restore" />
    <Exec Command="dotnet swagger tofile --output /path/to/swagger.json .\$(OutputPath)$(AssemblyName).dll v1" />
</Target>
```
- OutputPath and AssemblyName are the project variable, and they have the path to where the build is and `dll` is generated. 
- If you have multiple version of the APIs, you can have `v1` or `v2` in the second command. 

- Build your csproj and your openapi spec (swagger json) is created during the build. 

### PostScript
Feel free to reach out to me if you need any help.

[linkedin.com/in/ankurcharan](https://www.linkedin.com/in/ankurcharan/)
[instagram.com/ankurcharan](https://www.instagram.com/ankurcharan/)
[dev.to/ankurcharan](https://dev.to/ankurcharan)
[twitter.com/ankurcharan](https://twitter.com/ankurcharan)
[ankurcharan.hashnode.dev](https://ankurcharan.hashnode.dev/)
First Failure of #12Months12Startups
Tags: startup, webdev, beginners, student
Published: 2024-03-03 18:35:00



Hello people! #12Months12Startups is a challenge I decided to undertake in order to practice the principle I hear a lot "fail fast, learn fast". The challenge is to create a SAAS every month until one of them becomes profitable, I think it'd be a nice learning experience overall, even the failures count as learning. That said, here is the first failure of the year and what I've learned

Month 1, My Attempt At Joining The AI Train (https://www.practici.ca) :

![Picture of Practici's logo featuring the tagline , a better way to study](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0o7uf9775w1vepth5n15.png)


I came up with the idea after discussing with a classmate how hard it is to study considering most of our classes don't offer past papers and a lot of study guides always recommend using past papers as an aid, and so Practici was born. Practici helps students convert PDFs into test questions efficiently, allowing easier studying and practice through the use of active learning. After getting only 3 upvotes on ProductHunt, only 2 runs of the trial version, 37 impressions with 0 clicks as per Google, I've decided that Practici has failed to be a profitable venture. Here's what I've learned in creating it:

   1) Building something you want and something a lot of other people want and are willing to pay for, are 2 different things

   2) B2C is seemingly harder than B2B

   3) Marketing matters, your product won't sell itself. I tried promoting Practici via the GetStudying subreddit and got banned a couple hours later, despite the post getting a lot of views, nobody used the product (I look at API usage to gauge if people try and generate questions). 

The ban deterred me from posting on other relevant subreddits such as r/college and so I went and posted a simple TikTok showing a straightforward product demo, the post got 66 views, no usage, no signups. I tweeted about the MVP, got 200+ views, not a lot of interest either, posted the semi-finished product, even less views.

 4) I learned about hosting and a bit about Stripe and feel more confident in using it for future projects.

 5) Learned about TailwindCSS and TailwindComponents since I suck at design

In conclusion, I failed the first month of my own challenge but at the end of the day, I made the decision to build something I thought would be useful and in doing so I learned a lot. I must say, it feels good to have actually executed something rather than spending all my energy thinking about doing something. If anybody else is interested in doing this challenge, starting at month 2, just post your progress here or on Twitter with the hashtag #12months12startups. Thanks for reading! All the best if you choose to undergo this challenge too. I have a part 2 of this story which I describe I got Practici up to 60+ users currently
Simple, Effective Writing Tips for Software Developers
Tags: programming, softwareengineering, productivity, discuss
Published: 2024-03-03 18:31:44

Creating and maintaining effective documentation is expensive, and often under-prioritized when a team has a deep backlog of work. However, well written documentation is an invaluable mechanism for knowledge sharing and communication. Well-executed documentation effectively shares important knowledge across a team, improves productivity and breaks down [information silos](https://en.wikipedia.org/wiki/Information_silo). Below are 5 lightweight, effective forms of documentation that help capture important knowledge across a team's software development process.

## 1. README.md 
Including a `README.md` file directly with the source code is an easy way to document basic information about how to work with software. Typical content for a good `README.md` includes basic information about the purpose of the system, how to build and run the software, and links to relevant CI/CD pipelines and related software. 

## 2. CONTRIBUTING.md
A `CONTRIBUTING.md` file can also be included with the source code to describe how to contribute to the code. `CONTRIBUTING.md` can include brief descriptions of things like overall code organization, how to test and submit bug fixes, expectations for code comments, and more. 

## 3. Checklists and Standard Operating Procedures
Checklists and Standard Operating Procedures(SOPs) are an underrated mechanism for reducing human error and codifying important processes. Create a repository of checklists and SOPs for things like testing processes, code review steps, any manual deployment steps, and other routine tasks. 

## 4. HOWTO / FAQ
Keeping a document that details common tasks and Frequently Asked Questions (FAQs) is a great way to document team knowledge that may not fall in to a typical `README` or `CONTRIBUTING` document. These can be things like "how do I find logs for X", "How do I add a new service to the system?", "How Do I debug a failed deployment?" and other questions can be documented in a FAQ or HOWTO document. 

## 5. Architecture Decision Records 
Architecture Decision Records (ARDs) are a great way to document not only "what" but "why" important decisions were made on how to implement important parts of a system. Documenting the evaluations and rationale of important design decisions in a lightweight format is an invaluable tool for passing down knowledge across a team. 

While there are many ways to document and track knowledge across a team, these are a few ideas for creating lightweight documentation that I've personally used with success across teams. What other ways have your teams successfully captured key knowledge of software and systems?
Docker Compose: Quick Local Development Setup - Postgresql
Tags: postgres, docker, database, tutorial
Published: 2024-03-03 18:25:46

Hello everyone,

Sharing a quick setup guide for PostgreSQL docker-compose to get your local development started. 

<u>_Prerequisite: [Docker](https://www.docker.com/products/docker-desktop/) & [docker-compose](https://docs.docker.com/compose/install/linux/) installed_</u>

**Let's Start**
Please create a new yml file(I created _postgres-local.yml_).

Select the version of Postgres from [Dockerhub](https://hub.docker.com/_/postgres) that you wish to use. I will be using:

- postgres:16.2-alpine

Edit the yml file

```
services:
  local-postgres-service:
    container_name: local-postgresql
    image: postgres:16.2-alpine
```

> _local-postgres-service_ - Name of service
> _local-postgresql_ - Name of docker container
> _postgres:16.2-alpine_ - postgres image with tag from Dockerhub

Now, we need to set the environment variables for our PostgreSQL

```
services:
  local-postgres-service:
    container_name: local-postgresql
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: postgres_user
      POSTGRES_PASSWORD: pass123
      POSTGRES_DB: local-db
```
> _postgres_user_ - username
> _pass123_ - password
> _local-db_ - database name

To connect with this postgres container we need to bind port. Postgres container will run at port 5432, we will bind this to port 5000.

```
services:
  local-postgres-service:
    container_name: local-postgresql
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: postgres_user
      POSTGRES_PASSWORD: pass123
      POSTGRES_DB: local-db
    ports:
      - "5000:5432"
```
We need to make the data persistent using docker volumes.

```
services:
  local-postgres-service:
    container_name: local-postgresql
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: postgres_user
      POSTGRES_PASSWORD: pass123
      POSTGRES_DB: local-db
    ports:
      - "5000:5432"
    volumes:
      - local-postgres-volume:/var/lib/postgresql/data

volumes:
  local-postgres-volume:
```
> _local-postgres-volume_ - volume name where data will persist
> _/var/lib/postgresql/data_ - path of data inside postgres container

Finally, let's add this to a docker network

```
services:
  local-postgres-service:
    container_name: local-postgresql
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: postgres_user
      POSTGRES_PASSWORD: pass123
      POSTGRES_DB: local-db
    ports:
      - "5000:5432"
    volumes:
      - local-postgres-volume:/var/lib/postgresql/data
    networks:
      - local-postgres-network

volumes:
  local-postgres-volume:

networks:
  local-postgres-network:
```
> _local-postgres-network_ - docker network name

Start the container in detach mode using:
`docker compose -f postgres-local.yml up -d`
Stop the container using:
`docker compose -f postgres-local.yml stop`

Let's check the connection to our postgres container

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e27xnmhw5scr4bl5th4z.png)

Thank you for reading !!!
Goal to be have by every fullstack Developers
Tags: webdev, javascript, beginners, fullstack
Published: 2024-03-03 18:15:25

- Master a New Programming Language or Framework.
- Contribute to Open Source Projects.
- Build a Full Stack Application from Scratch.
- Optimize Application Performance.
- Gain Expertise in Cloud Computing.
- Strengthen Security Acumen.
- Attain a Full Stack Developer Certification.
- Improve DevOps Skills.
- Enhance Team Collaboration.
- Mentor Junior Developers.
- Stay Abreast of Industry Trends.
- Achieve Work-Life Balance.
How to get source, medium, campaign etc. from each page visit, like Google Analytics does it?
Tags: webdev, analytics, marketing
Published: 2024-03-03 18:13:19

You sometimes need to know how you got each individual customer to your web site. Using Google Analytics, you only know at an aggregate level. You can analyze things inside Google Analytics, but you can't take that information out.

For example. Let's say your users can sign up to a product and maybe start paying for it? Maybe it's a subscription product, where lifetime values need to be observed over long periods of time. Google Analytics doesn't help with that, since it is designed for transactional, webshop-like businesses.

Well, you're in luck. I have just the thing you need.

I've created a library called [VisitDataJS](https://github.com/ilkkapeltola/visitdata) that emulates the behavior of Google Analytics and provides the same dimensions for each visitor:

- medium
- source
- campaign
- content
- term

The library is already quite popular, getting between 5M-7M page loads every _day_. But for some reason, the github repo is not very active. So I'm looking for more active users, feedback.

Head over to https://github.com/ilkkapeltola/visitdata and check it out.
Unveiling JavaScript: Your Gateway to the Dynamic Web
Tags: webdev, javascript, beginners, programming
Published: 2024-03-03 17:43:29


Have you ever wondered how websites come alive with animations, smooth interactions, and real-time updates? The secret ingredient is often **JavaScript**, a powerful and versatile programming language that has become the backbone of the modern web. Today, we'll unveil its wonders, exploring its uses, popular frameworks, and why you should consider learning it.

**JavaScript: From Humble Beginnings to Web Domination**

Born in 1995, JavaScript started as a way to add interactivity to web pages. Today, it's much more. It's used to:

* **Make websites interactive:** Think of those cool animations, image carousels, and forms that check your input as you type – that's JavaScript in action!
* **Build mobile apps:** Frameworks like React Native let you use JavaScript to create apps for both Android and iOS, saving time and resources.
* **Power the backend:** Node.js, a game-changer, allows JavaScript to run on servers, enabling communication between the user interface and the data behind it.
* **Develop games:** Engines like Unity and Phaser use JavaScript to create engaging games for various platforms.

**JavaScript Frameworks: Building on a Solid Foundation**

While JavaScript is powerful, frameworks like **React, Angular, and Vue.js** can make your life easier. These frameworks provide pre-built structures and functionalities, like:

* **Reusable components:** Imagine building blocks for your code. Frameworks let you create these components, making complex applications easier to manage and maintain.
* **Simplified data binding:** Keeping your website's visuals in sync with the underlying data can be tricky. Frameworks make this process smoother.
* **Seamless communication:** Frameworks ensure smooth interaction between what users see (the interface) and what's happening behind the scenes (the data).

**Choosing the Right Framework: A Popularity Contest**

* **React:** The current champion, known for its flexibility and vast community support. Learn more: [https://react.dev/](https://react.dev/)
* **Angular:** A comprehensive framework favored for large-scale, complex applications. Learn more: [https://angular.io/](https://angular.io/)
* **Vue.js:** A rising star, praised for its ease of use and balance of features. Learn more: [https://vuejs.org/](https://vuejs.org/)

**Why Learn JavaScript? Open Doors to Exciting Opportunities**

JavaScript is not only versatile but also in high demand. Mastering it opens doors to exciting careers in web development, mobile app creation, and even game development. Additionally, its beginner-friendly nature makes it a great starting point for anyone interested in programming.

So, are you ready to unlock the power of JavaScript and build the dynamic web of tomorrow? Dive in, explore its potential, and join the thriving community of JavaScript developers!

Want to learn more about programming?Follow along!
Know anyone interested in JavaScript? Share this with them!
Synchronization
Tags: opensource, fpga, synchronization
Published: 2024-03-03 17:39:07

We are starting the process of integrating synchronization functions into the receiver for Opulent Voice, our open source high definition voice and data protocol for amateur radio and industry use. The shared image is an early clock recovery result from this work. Recovering the clock is essential in getting the best estimation of the received symbols. 

We will be comparing several different methods in simulation, including digital bandpass filters, PLLs, NCOs, and polyphase techniques. 

If you're interested in this sort of work, please check out https://openresearch.institute/getting-started
Tips on searching for a job in today Job Market
Tags: career, community
Published: 2024-03-03 17:14:24

I had an amazing time listening to 8 speakers share their recent experience on job hunting in today's tech job market at a Code Connector virtual tech meetup. Here are my biggest takeaways:

## On the job Hunt:
1. **Be great no matter where you are in your journey.** You never know who is watching and is ready to give you an opportunity. 
2. **Volunteer as much as possible.** A big part of finding a job is connecting with others. Show your passion. 
3. **Great suggestions while unemployed:** Take mental breaks, grow a support network, and dive into technology you are interested in. 
4. **Go to as many meetups/events as you can and build as many side projects as you can manage.** The goal is to de-risk yourself by getting your name out there and what you can accomplish. 
5. **Be open to a non-development job as that first job.** A dev-adjacent role can make it easier to transition into doing development stuff even before you have a coding role. Focus on providing business value.
6. There is another side of software development other than web development. 

## The Interview
7. Practice effective talk about past achievements and projects
8. In an interview, determine what the hiring manager's pain points are and then show that you can solve them.
9. The more you communicate with others, the easier it gets to notice those social cues. Examples are you're talking for a bit longer or not long enough. Just like you get better at coding by practicing, communication is something to practiced.

## Once you get the Job:
Being a great team member and becoming an expert at a skill matters. You will be amazed at how opportunities pop up and you're able to fast-track the interview process.

Shout out to speakers Corey McCarty, Coriano Harris, Storm O'Bryant, Dennis Kennetz, Karen Dillehay, Justin Carter, and Joseph Raynovic.