teleren/devto huggingface dataset:
[note]Rails HTTP Code and Symbol mapping
Published: 2021-08-30 16:00:04

## References

* [Rack::Utils::HTTP_STATUS_CODES](https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L492)
* [https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L520](https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L520)

## HTTP status code symbols for Rails

Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.

## 1xx Informational

```ruby
100, :continue
101, :switching_protocols
102, :processing
```

## 2xx Success

```ruby
200 :ok
201 :created
202 :accepted
203 :non_authoritative_information
204 :no_content
205 :reset_content
206 :partial_content
207 :multi_status
226 :im_used
```

## 3xx Redirection

```ruby
300 :multiple_choices
301 :moved_permanently
302 :found
303 :see_other
304 :not_modified
305 :use_proxy
307 :temporary_redirect
```

## 4xx Client Error

```ruby
400 :bad_request
401 :unauthorized
402 :payment_required
403 :forbidden
404 :not_found
405 :method_not_allowed
406 :not_acceptable
407 :proxy_authentication_required
408 :request_timeout
409 :conflict
410 :gone
411 :length_required
412 :precondition_failed
413 :request_entity_too_large
414 :request_uri_too_long
415 :unsupported_media_type
416 :requested_range_not_satisfiable
417 :expectation_failed
422 :unprocessable_entity
423 :locked
424 :failed_dependency
426 :upgrade_required
```

## 5xx Server Error

```ruby
500 :internal_server_error
501 :not_implemented
502 :bad_gateway
503 :service_unavailable
504 :gateway_timeout
505 :http_version_not_supported
507 :insufficient_storage
510 :not_extended
```
Create a new Promise in JavaScript?
Tags: javascript, react, node, codenewbie
Published: 2020-03-20 16:30:27

---
canonical_url: https://bonsaiilabs.com/create-promise
---

This video covers how to create a new Promise in JavaScript and what are the states of a Promise.

You can access the code at https://bonsaiilabs.com/create-promise/

{% youtube RK_0h-slUIA %}

Subscribe for more videos on JavaScript with Visualization: https://www.youtube.com/channel/UC0yZBnRsD9JRqLXBkfGym0Q?sub_confirmation=1
Create Your Own Elegant Code Screenshots with Carbon
Tags: productivity, career, javascript, programming
Published: 2020-04-16 11:01:08

---
title: Create Your Own Elegant Code Screenshots with Carbon
published: true
description: I often get asked how I make "those great screenshots" of my code that I share on social media and here on dev.to. The answer is simple: I use the website https://carbon.now.sh!
tags: productivity, career, javascript, programming
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/3t1jn828shr1qn4xh3ew.png
---

I often get asked how I make "those great screenshots" of my code that I share on social media and here on dev.to. The answer is simple: I use the website https://carbon.now.sh!

Furthermore, Carbon has a VS Code extension that, when used, will send your currently-selected code over to the Carbon website ready for screenshotting.

Here's an example screenshot:

![Example code screenshot](https://dev-to-uploads.s3.amazonaws.com/i/3t1jn828shr1qn4xh3ew.png)

And here's one of the tweet's I've shared that has performed well, largely due to the quality of the screenshot:

{% twitter 1248757906662711301 %}

You too can share tips and code clearly using Carbon! 

Happy learning/teaching!
Been a busy boy
Tags: css, graphics, html, javascript
Published: 2020-05-11 15:29:56

---
title: Been a busy boy
published: true
date: 2019-07-29 11:02:00 UTC
tags: CSS,Graphics,HTML,JavaScript
canonical_url: https://drmsite.blogspot.com/2019/07/been-busy-boy.html
---

[![](https://4.bp.blogspot.com/-ZkIlr2bwj6s/XT7SHREGzNI/AAAAAAAAhps/6Rnn5ptGlsIz55i-84rNs9DjutImslYOgCLcBGAs/s320/2019-07-29_1155.png)](https://4.bp.blogspot.com/-ZkIlr2bwj6s/XT7SHREGzNI/AAAAAAAAhps/6Rnn5ptGlsIz55i-84rNs9DjutImslYOgCLcBGAs/s1600/2019-07-29_1155.png)

I've just had a busy old weekend and managed to get my digital counter working with CSS animations. I have been wanting to do this for ages but haven't had the time to research the technique correctly. It's [here](https://annoyingmouse.js.org/WireFrameJS/000-MISCELLANEOUS/COUNTER/), and I'm quite pleased with the result despite it taking a shed load of tweaking to get right.

I've also caught up some on updated p5 implementations from WireFrame, and I've added three projects to the [site hosted by GitHub](https://annoyingmouse.js.org/WireFrameJS/), all to do with mazes. The [first](https://annoyingmouse.js.org/WireFrameJS/018-MAZE/) uses an algorithm to generate a maze, and I got lost in the [C implementation](https://github.com/Wireframe-Magazine/Wireframe18/tree/master/maze-algorithms) but found [a set of videos](https://www.youtube.com/watch?v=HyK_Q5rrcr4) from [The Coding Train](https://thecodingtrain.com/) that went through the steps required. I've pretty much stolen them but made them a little more ES6y. The [second](https://annoyingmouse.js.org/WireFrameJS/018-MONSTERMAZE/) draws the view of a character navigating a maze, and I'm impressed with the cheating in terms of the images used to illustrate the perspective required. The [third](https://annoyingmouse.js.org/WireFrameJS/015-ANT_ATTACK/) and final one also cheats by using images to build up a semi-3D illustration of a landscape and was lots of fun (you can navigate using the arrow keys)!
How to use the Tailwind JIT compiler
Tags: tailwindcss
Published: 2021-04-18 09:28:35

Recently, Tailwind v2.1 was released with the JIT compiler included. The JIT (Just In Time) compiler only generates CSS that you actually use, instead of all sorts of classes that you (almost) never use, like `subpixel-antialiased`, `place-self-start`, and `backdrop-brightness-95`. And even better compiling your CSS goes extremely fast, about 100ms.

If you don't know what Tailwind CSS is or how to use it, [read my post](https://www.jeroenvanrensen.nl/blog/tall-stack) about it.

## The Problem

The main problem with Tailwind CSS was the large development file size. In that file lots of classes are included, most of which you will never use. Because of this, not all spacing variants (like `mt-35`) are included. Moreover, if you want to use special variants like `group-focus` and `disabled` are not included by default.

When going into production, you had to run `npm run prod`, to purge all unused CSS classes. That means your deployment process takes more time, so users have to wait longer before they can use your website.

## The solution

The team behind Tailwind CSS has created the JIT compiler to solve this problem. Once you make a change in one of your files, your CSS gets recompiled with only the classes you actually use.

Compiling CSS has become lots faster. Whereas it used to take a few seconds, now it only takes 100ms, according to [the official announcement](https://blog.tailwindcss.com/just-in-time-the-next-generation-of-tailwind-css) even 3ms.

## How to use it

If you want to use the JIT compiler, follow these steps:

First, install Tailwind v2.1: 

```
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
```

Next, add this to your `tailwind.config.js` file:

```js
// tailwind.config.js

module.exports = {
    mode: 'jit',
    purge: [
	    './resources/**/*.blade.php'
    ],
    //
}
```

Finally, run `npm run watch`, and keep it running.

## Benefits

Using the JIT compiler has more benefits:

- **Compiling CSS is fast**: whereas it used to take a few seconds to compile your CSS, now it gets done within a few milliseconds.
- **All variants are enabled**: you can use variants like `focus-group`, `active` and `disabled` without configuring anything to your configuration file.
- **Browsers perform better**: when you have a very large CSS file, browsers become slow. When using the JIT compiler, only used CSS will be generated, so inspecting HTML/CSS is quicker.
- **You don't have to worry about purging**: sometimes, when you are purging for production, some classes don't get purged, and your design breaks. When using the JIT compiler, purging is done when developing, so you have the same file.
Wednesday Links - Edition 2020-07-15 
Tags: java, spring, jvm, maven
Published: 2020-07-15 10:06:06

First milestone of Reactor 2020.0 -Codename Europium ( 5 min read ) ☢️
https://spring.io/blog/2020/07/10/first-milestone-of-reactor-2020-0-codename-europium

The Spring team wants to hear from you! ( 40 sec read ) 🎤
https://spring.io/blog/2020/07/14/the-spring-team-wants-to-hear-from-you

APM headers in Kafka records ( 20 sec read ) 🐦
https://twitter.com/criccomini/status/1281632338128932864

Quick tip: ISO 8601 durations in Java ( 1 min read ) ⌛
https://www.mscharhag.com/java/iso8601-durations

Generating UUIDs at scale on the Web ( 12 min read ) 🆔
https://medium.com/teads-engineering/generating-uuids-at-scale-on-the-web-2877f529d2a2

Java Agent - Bond or Smith? ( 7 min read ) 🕵️
https://zserge.com/posts/javaagent/

ZGC and Using -XX:SoftMaxHeapSize ( 4 min read ) 🥞
https://malloc.se/blog/zgc-softmaxheapsize

Trying Rootless Docker with Testcontainers ( 8 min read ) 🛳️
https://bsideup.github.io/posts/rootless_docker/

Reposilite - Lightweight repository manager for Maven artifacts ( 30 sec read ) 📦
https://reposilite.com/

The Concept of Domain-Driven Design Explained ( 8 min read ) 🏢
https://dev.to/microtica/the-concept-of-domain-driven-design-explained-1ccn

What is difference between Heap and Stack Memory in Java JVM ( 6 min read ) 🧠
https://www.java67.com/2016/10/difference-between-heap-and-stack-memory-in-java-JVM.html

How to track and display profile views on GitHub ( 3 min read ) 🏷️
https://rushter.com/blog/github-profile-markdown/

Building stackoverflow-cli with Java 11, Micronaut, Picocli, and GraalVM ( 14 min read ) 📺
https://e.printstacktrace.blog/building-stackoverflow-cli-with-java-11-micronaut-picocli-and-graalvm/
Starting a Python project
Published: 2020-07-16 01:07:13

1. `$ mkdir ~/my_project` Create project directory under user home.
2. `$ cd ~/my_project`
3. `$ git init` Create git repo. 
4. `$ python -m venv venv` Create virtual environment within the project directory. Preferred over a centralised virtual environments directory e.g. `my_venvs/my_project` as it is easier to find and manage. Not a hidden directory e.g. `.venv` for visibility.
5. `$ source venv/bin/activate`
5a. `$ source venv/Scripts/activate` for Python 3.9+
6. `$ pip install pip --upgrade` Because for some reason the virtual environment's pip is an older version?! Hints of Python dependency hell emerging.
TypeScript and Netlify Functions
Tags: typescript, netlify, serverless
Published: 2020-07-18 13:25:17

Did you know that Netlify Functions are just using AWS Lambdas behind the scenes?

This means you can use the same type definitions available for aws-lambda for your Netlify functions too. Install the aws-lamda types by running the following.

```bash
npm install @types/aws-lambda --save-dev
```

You only need  to import the `APIGatewayProxyEvent`, `APIGatewayProxyCallback` types like so.

```ts
import { APIGatewayProxyEvent, APIGatewayProxyCallback } from "aws-lambda";

export const handler = async function (
  event: APIGatewayProxyEvent,
  context: any,
  callback: APIGatewayProxyCallback
) {
  // Do some stuff here	
};
```

Note, there are no type declarations available for `context` as this includes properties and methods specific to Netlify such as [Netlify Identity](https://docs.netlify.com/functions/functions-and-identity/#access-identity-info-via-clientcontext) .  

However, having auto completion for `event` alone makes this hugely useful!

I'm putting together some TypeScript Netlify Functions examples over at this [repo](https://github.com/chiubaca/typescript-netlify-functions-starter). Feel free to give it a star if you find it helpful.
Animatronics with Artificial Intelligence — Brings Unimaginable Results
Tags: machinelearning, writing
Published: 2020-07-18 18:20:37

Have you ever heard of Animatronics? It is the integration of Animation and Electronics. Imagine what wonders we could achieve with Artificial Intelligence with Animatronics working together. Here's an article that gives a gist of the possibilities we can have access to in case we use it with AI. Hope you enjoy it!

https://towardsdatascience.com/animatronics-with-artificial-intelligence-brings-unimaginable-results-407983acf39
Last Form component you need
Tags: react, npm, showdev, codewithghazi
Published: 2020-08-16 19:45:46

I have published my first NPM library for React Form, I have created this form component in my last 3 years of experience, have tested this component with more than 8 projects and found it very useful. 

There were times when creating form layouts, handling validations, and creating data for API POST and populating form data from the server took a bit time to incorporate in the application. So with every project, I was working I improved this component and reached a level where I found this component very useful and saved lots of time in Form Development with all aspects I mentioned above.

I saved approximately a day work on working on forms with react apps.

After testing this component with my previous projects I though to create an npm library for this component so that it can be helpful to other developers too.

[Formify React](https://www.npmjs.com/package/formify-react)

Request you guys to use and give your feedback. Also star this repo [Formify React Github](https://github.com/gkhan205/formify-react)

[![Edit formify-react](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/formify-react-v9pkv?fontsize=14&hidenavigation=1&theme=dark)
Why I Decided to Study Software Engineering
Tags: student, flatiron, codenewbie, career
Published: 2020-10-19 18:47:12


Why did I decide to learn software engineering? The short and cliche answer is:
 
*Balance*. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g8o6dh92bym4k56q5i4u.jpg)

I consider myself to have a creative heart. Since I was little I have loved project oriented hobbies. As a kid I was obsessed with medieval weaponry, trying to build a trebuchet or crossbow out of household items. Running the constant risk of getting parentally scolded, I frequently took apart my RC cars that I had just got for my birthdays, just to try to put it back together. This habit usually ended with a non-functional piece of junk, but I loved the way it felt when I got something to work. 

As I got older, my creative energy shifted from mechanical to more artistic and expressive. I learned to play and record music, which is still one of my favorite ways to spend time. Similar to building household gizmos as a kid, finishing a song and having people listen and enjoy gives me an immense feeling of accomplishment, satisfaction, and fulfillment. I made this, and it's mine. While attending college I studied film, philosophy, and music. After graduating I worked in television, but I found the work to be less fulfilling and less creative as I had expected in school. It was an exciting industry to be a part of, but I couldn't shake the feeling that something was missing. Then, the COVID pandemic hit, the industry was on pause, and I had a moment to sit back and reevaluate my life's direction. 

*I looked to the things I loved and extracted the qualities that made them lovable.* 

Film and music were expressive and more abstract, while philosophy was logical. With time to reflect, I realized that I needed a career that was creative and that *balanced* my logical and abstract qualities. I had taken a couple coding classes in college and was always interested in learning more. So during the start of the pandemic I decided to learn on my own. As it turned out, programming was exactly what I was looking for. It felt like a perfect *balance* of problem solving and abstract creative thinking. Couple that with intense feelings of euphoria during those 'aha' moments in figuring something out and making something work, I knew programming was something I had to pursue seriously. A few months later and I find myself beginning Flatiron School's full time software engineering program. I know this journey will be extremely challenging, but I am beyond excited to delve into the world and career of programming.
Daily Developer Jokes - Sunday, Feb 14, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-02-14 13:00:23

---
title: "Daily Developer Jokes - Sunday, Feb 14, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20Feb%2014%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12596739999.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why couldn't the React component understand the joke?

___A:___ Because it didn't get the context.
 -->
How do I become a DevOps engineer?
Tags: devops
Published: 2021-03-22 09:27:33

---
title: How do I become a DevOps engineer?
published: true
date: 2021-03-21 00:00:00 UTC
tags: devops
canonical_url: https://jhall.io/archive/2021/03/21/how-do-i-become-a-devops-engineer/
---

A question I hear a lot is “How do I become a DevOps engineer?”

I have two answers to this question.

The first probably isn’t very satisfying:

**“DevOps Engineer” is an oxymoron.**

DevOps, as a philosophy, is the idea that Development and Operations should work together, in [cooperation](https://jhall.io/archive/2021/02/11/devops-is-just-cooperation/).

My second answer addresses what I expect most people mean by the question: How can a developer adopt a more DevOps mindset, and possibly even move into operations?

The shortest answer I can offer to this question is: **Learn to ship your own code.**

To elaborate a bit on that: “DevOps” is about the full application lifecycle, so if you want to improve your DevOps skills, learn to operate in all stages of that lifecycle, not just coding. That means learning to ship your own code, learning to deploy your own code, learning to monitor your own code.
How to Create Subscribe Call to action Form 
Tags: codepen
Published: 2021-04-10 06:12:22

For the last few days, I've been working on a Some Design parts. I've always believed that a creativity is important for any dev since it connects you to future opportunities and it helps you to grow your network.

Today I create a Subscribe call to action design using pug, SCSS, and JavaScript (Babel). There's still some stuff to improve, like making more creative, tweaking some UX, etc. So it's still a WIP, for sure. But hey, everyone has to start somewhere, right?

I tried Code Pen to write my codes there. What is Code-Pen? Code-Pen is a social development environment for front-end designers and developers. This is basically help you to Build and deploy a website, Show off your works and build test cases to learn and many mores. If you want to Know more about Code-Pen visit Codepen.io for more information.

Let's Start the todays hot topic "How to create subscribe Call to action page". I have share the link of my code, You can go with the link ant get the source code. 

I use Html, SCSS, and JavaScript(Babel) to create this design. 

https://codepen.io/itanand/pen/dyNJRva
VS Code - Get type checking in JavaScript easily
Tags: webdev, javascript, tooling
Published: 2021-08-16 08:18:24

Did you know you can type check JavaScript code in VS Code?

VS Code allows you to leverage some of TypeScript's advanced type checking and error reporting functionality in plain old JavaScript files. And you can even do some quick fixes! This can be done alongside ESLint without any issues.

The type checking is opt-in. You can apply it to an individual file, per project, or everywhere.

## Enable checking in individual files

If you want to try it out for a file, just add the comment `// @ts-check` to the top of a file. For example, the code below tries to multiply a number with a string.

```javascript
// @ts-check

let x = "blah";
let y = x * 2;
```

You will see red underlining under the offense to point out the error, and you will see the error in the problems tab.

![builtin extension list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yk27a43jav2gwimhe61v.png)

## Enable checking in your workspace or everywhere

You can enable type checking for all JavaScript files with the `JS/TS › Implicit Project Config: Check JS` setting.

Alternatively, you can place a `jsconfig.json` in your root folder, and specify your [JavaScript project options](https://code.visualstudio.com/docs/languages/jsconfig). You can add type checking as a compiler option as below:

```json
{
  "compilerOptions": {
    "checkJs": true
  },
  "exclude": ["node_modules", "**/node_modules/*"]
}
```

The advantage of using `jsconfig.json` is that you can target the files you want checked through `include` and `exclude`.

You can use `// @ts-nocheck` to disable type checking inside a file if you want to make an exception also.

## Add extra type checking with JSDoc comments

[JSDoc](https://jsdoc.app/) annotations are used to describe your code and generate documentation. Part of that specification is to add types to variables, through this we get can extra type checking in VS Code.

JSDoc annotations come before a declaration in a comment block. In the example below, I specify a type for the parameter and the return value.

![builtin extension list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwqhza0iejda3ng9lqh2.png)

You can see it catches a mistake when I provide a number as argument for the function call `isHoriztonalRule(1)`.

You can find the full list of supported JSDoc patterns in: [TypeScript Reference - JSDoc Supported Types](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).

## Conclusion

Getting type checking in JavaScript is pretty sweet. It is simple and flexible to use. It provides some of the benefits of TypeScript without needing to convert a codebase to TypeScript.

Happy hacking!