teleren/devto huggingface dataset:
How to Access Hash Values Like Methods in Ruby
Tags: ruby, rails
Published: 2022-04-27 03:10:14

In Ruby, if you want to access hash values like methods on an object, use [`ActiveSupport::OrderedOptions`](https://api.rubyonrails.org/classes/ActiveSupport/OrderedOptions.html). This class inherits from `Hash` and provides dynamic accessor methods.

Typically, you'd do this with a Hash. 

```ruby
person = {
	name: "Jason",
	company: "Basecamp"
}

person[:company] # 'Basecamp'
```

Using `OrderedOptions`, you can write

```ruby
require "active_support/ordered_options"

person = ActiveSupport::OrderedOptions.new

# set the values
person.name = "Jason"
person.company = "Basecamp"

# access the values
person.name  # => 'Jason'
person.company # => 'Basecamp'
```

### Implementation

Behind the scenes, Rails implements this feature using metaprogramming in Ruby. It uses the `method_missing` method to handle the method call. 

```ruby
def method_missing(name, *args)
  name_string = +name.to_s
  if name_string.chomp!("=")
    self[name_string] = args.first   # set the value
  else
    bangs = name_string.chomp!("!")

    # get the value
    if bangs
      self[name_string].presence || raise(KeyError.new(":#{name_string} is blank"))
    else
      self[name_string]
    end
  end
end
```

You can read the complete source code [here](https://github.com/rails/rails/blob/3520cc77df1b52a6c808083214b583c769e9a4b2/activesupport/lib/active_support/ordered_options.rb). For more details on metaprogramming in Ruby, read my notes of the [Metaprogramming Ruby 2](https://akshaykhot.com/books/metaprogramming-ruby/) book.

### Real-World Usage

[Propshaft](https://github.com/rails/propshaft) is an asset pipeline library for Rails. It uses `OrderedOptions` to define the `config.assets` settings, instead of creating a new configuration object. You can read the complete source on [Github](https://github.com/rails/propshaft/blob/a4ddf9a14294681f47f93fa106ebae9093ad41a9/lib/propshaft/railtie.rb#L6). 

```ruby
class Railtie < ::Rails::Railtie
    config.assets = ActiveSupport::OrderedOptions.new
  
    config.assets.paths          = []
    config.assets.excluded_paths = []
    config.assets.version        = "1"
    config.assets.prefix         = "/assets"
end
```

Now, this doesn't mean you have to replace all your hashes with instances of `OrderedOptions`. It's better to use them with configuration-like objects, which often results in more readable code. 

Hope that helps. Let me know what you think about this approach.
Vuetify Error: You cannot call "get" on a collection with no paths.
Tags: javascript, vue, tutorial
Published: 2022-04-27 02:26:37

## Why this error exists?

The current default version of Vuetify doesn't support Vue 3


## How to Fix?

Don't  choose the Default rather, select the Vuetify 3 Preview to install.

---

## Reference

https://vuetifyjs.com/en/introduction/roadmap/

---
Generating SVG Art in your browser
Tags: typescript, svg, art, showdev
Published: 2022-04-27 02:11:41

Lately I was looking for a new creative personal project and got inspired after reading an article titled [Creating generative SVG Grids](https://frontend.horse/articles/generative-grids/). I wanted to play around with the concept itself and create a complete PWA around it:

## SVG Artwork Generator

![Preview image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xwi2gyt5hmlcxsl89xc0.png)

- Set the block size, number of rows &amp; columns
- Choose a random seed (your random grid can stay the same while you change the palette
- Choose a palette (I am currently creating more palettes)
- Download your palette as an SVG or PNG

> **Go check it out [here](https://svg-artwork-generator.vercel.app)**

The source code for the project can be found on [Github](https://github.com/j3lte/svg_artwork_generator)
Linked Lists in C
Published: 2022-04-27 02:07:03

The idea behind linked list is about moving creating node-pointers to  store addresses, moving addresses to node-pointers declared individually or node-pointers contained in a node.
Understanding the process and being able to relate with it in real life situations makes understanding better.

To understand the concept of linked lists think of a chain of paper clips all connected together. 
![Paper Clip Description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bytjazd7u1pmltztfak7.jpg)
The basic operation performed on a linked list can be seen in the following ways:

1. Creating a chain of paper clips (or a linked list) is done by connecting each paper clip end to end until you choose to stop.

2. To add a paper clip in the middle of a chain of paper clips you'll have to break the connection, keep the second half of the chain somewhere, connect the new paper clip to the other half of the chain, then connect the second half of the chain that was kept away to the end of the newly connected paper clip.

3. Removing a paper clip (or a node) follows a similar simple process. Locate the point of paper clip tat needs to be removed. Split the chain of paper clips from that point but don't forget to always store the second half of the chain somewhere [like a temp variable :)]. Follow the same procedure as above and you're good to go.

Implementing the code for the above can now be easily done. Good luck :)
#100DaysofCode - Day[2](3)
Tags: 100daysofcode, python, newbie, beginners
Published: 2022-04-27 01:47:22

---
title: #100DaysofCode - Day[2](3)
published: true
description: 
tags: 100daysofcode, python, newbie, beginner
---

Today was a bit of a rough one. After a long day of actually going into the office for an all day meeting, I was feeling pretty drained. Especially after staying up later than I expected last night to post my experience from yesterday.

Nevertheless, I got through it. 😌

Today I learned about logical operators and if/else statements. There were some pretty neat exercises to be learned along the way as well. I made a leap year calculator, which is a bunch of if/else statements determining whether or not the year is evenly divisibly by 4, except years that are evenly divisible by 100, unless the year is also evenly divisibly by 400.

[leap-year-calculator](https://replit.com/@keatonpalmer/leap-year-calculator)

There is also this silly love calculator which calculates compatibility depending on the amount of letters in you and your partner's name and how many letters appear in the words "TRUE LOVE".

[love-calculator](https://replit.com/@keatonpalmer/love-calculator)


Finally, the most fun thing was doing a make your own text adventure kinda deal. Think back to the era of super super basic computer gaming, when text adventures were all the rage. It's short and silly, but I'd love to revisit the idea of a serious text adventure someday.

[treasure-island](https://replit.com/@keatonpalmer/treasure-island)
6 Different Ways To Clone An Array In JavaScript 📑
Tags: javascript, tutorial, tricks, array
Published: 2022-04-27 01:40:25

### What's an Array in JavaScript?

In JavaScript, an array is a single variable that is used to store different elements. It is often used when we want to store a list of values and access them by a single variable.

In some cases, you might need to update an array without affecting the original one by making a copy of it.

### Cloning an Array in JavaScript


1. Using Array.slice() — *the fastest way*
```js
var arrayToClone = [1, 2, 3]
let clone = arrayToClone.slice(0)
``` 

2. Using Array.concat()
```js
var arrayToClone = [1, 2, 3]
let clone = [].concat(arrayToClone)
```

3. Using Array.map()
```js
var arrayToClone = [1, 2, 3]
let clone = arrayToClone.map(value => value)
```

4. Spread Operator
```js
var arrayToClone = [1, 2, 3]
let clone = [...arrayToClone]
```

5. Using JSON.stringify() and JSON.parse()
```js
var arrayToClone = [1, 2, 3]
let clone = JSON.parse(JSON.stringify(arrayToClone))
```

6. Defining a custom clone() method  

  You can create your own clone() method in the prototype of your Array to use it whenever you need it.
  ```js
  var arrayToClone = [1, 2, 3]

  Array.prototype.clone = function() {
     return this.map(e => Array.isArray(e) ? e.clone() : e);
  };

  // this is how to use the method
  let clone = arrayToClone.clone()

  console.log(clone)
  ```

If you enjoyed this article, share it with your friends and colleagues!

Keep in touch,
- [Follow me on Twitter](https://twitter.com/JustE3saR)
- [Take a look at my open-source projects](https://github.com/6km)
Hello everyone!
Tags: introduction, beginners
Published: 2022-04-27 01:05:09

Hi, I'm _Mohigul_ and I'm new here)
I have got my B.S. in Biological Sciences. Currently I'm a M.S. student in the field of Biotechnology.
So, then there is question: **What is a science student doing here?**. Well, I'm quite interested in computers from my childhood. And now I'm learning IT. I hope it's gonna help my future career because bioinformatics is mixing with all the field of biology.
I will be learning basics of programming and also I will be sharing all what I learn here. 
**_So, let's go!_**
[Conceito] - HTTP 401 vs 403
Published: 2022-04-27 00:22:48

> Conteúdo original [nessa thread do Twitter](https://twitter.com/zanfranceschi/status/1519108612907433984)

---

Ei dev,

Tá claro o que "HTTP 401 Unauthorized" e "HTTP 403 Forbidden" significam? Você se confunde às vezes?

Chega mais que vou tentar desenrolar esse negócio :)

cc @sseraphini

🧵

![img](https://pbs.twimg.com/media/FRT1O2iVkAAr64f?format=png&name=small)

---

[ IMPORTANTE! O cenário aqui serve para quando a autenticação é requerida, tipo login/senha, por exemplo, ok? Existem cenários onde a autorização (ou não) independem da identificação ou, se preferir, a identificação anônima é suficiente. ]

---

Vou usar como analogia/exemplo aquele cenário clássico de visitar um prédio comercial que tem que dar o RG, pegar crachá, etc. pra tentar clarear esse negócio pra vc.

---

A primeira coisa a entender é que vc precisa se autenticar antes pra depois ser autorizado (ou não).

Se meter o louco e tentar acessar alguma coisa protegida sem autenticação, vai tomar um 401.

![img](https://pbs.twimg.com/media/FRT1PefUcAANUY7?format=jpg&name=medium)

---

Pra passar dessa fase (não tomar um 401), vc se autentica.

![img](https://pbs.twimg.com/media/FRT1P6WVEAAYiK5?format=jpg&name=medium)

---

Aí depois, pra vc poder tomar um 403, tem que estar autenticado e tentar acessar alguma coisa que não é pro seu bico.

![img](https://pbs.twimg.com/media/FRT1QZXUcAE2QyX?format=jpg&name=medium)

---

Depois de autenticado E autorizado, aí sim vc passa da fase 403.

![img](https://pbs.twimg.com/media/FRT1Qz9VgAA9bAM?format=jpg&name=medium)

---

É simplesmente isso do que tratam as respostas 401 e 403!

---

Algumas dicas:

- Lembre-se da ordem 401 -> 403.
- 401 Unauthorized significa sem credenciais válidas.
- 403 Forbidden significa que vc está identificado, mas não tem permissão.
- O oposto de Unauthorized é Authenticated.
- O oposto de Forbidden é Authorized (é zuado, eu sei)

---

Espero que tenha gostado e principalmente te ajudado em alguma coisa :)

Se ainda ficou com alguma dúvida, comenta aí que a gente se ajuda.
Simple Web Interactivity with Alpine.js
Tags: javascript, webdev, alpinejs
Published: 2022-07-17 22:43:53

---
title: Simple Web Interactivity with Alpine.js
published: true
date: 2022-04-27 00:00:00 UTC
tags: 
  - javascript
  - webdev
  - alpinejs
canonical_url: https://wildermuth.com/2022/04/27/alpine-js-for-web-interaction/
cover_image: https://wilderminds.blob.core.windows.net/img/2022/04/27/cover.jpg
---

After working with lots of these little JavaScript libraries, sometimes I pine for something simple  
to create interactivity on websites. In this Coding Short, I investigate Alpine.js to see how it works and where it might be useful:

> [Watch](https://www.youtube.com/watch?H-Dv2RIiYv8) 

> [View All Coding Shorts](https://shawnl.ink/codingshorts)
> [Subscribe to my YouTube Channel](https://shawnl.ink/yt)

[![Creative Commons License](http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/licenses/by-nc-nd/3.0/)

 This work by [Shawn Wildermuth](http://wildermuth.com) is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License](http://creativecommons.org/licenses/by-nc-nd/3.0/).  
 Based on a work at [wildermuth.com](http://wildermuth.com).

* * *

If you liked this article, see Shawn's courses on [Pluralsight](http://shawnw.me/pscourses).
Conditionally tagging resources in CloudFormation
Tags: aws, cloudformation
Published: 2022-04-27 00:00:00

---
title: "Conditionally tagging resources in CloudFormation"
date: "2022-04-27T00:00:00.000Z"
canonical_url: https://dereklawless.ie/conditionally-tagging-resources-in-cloudformation/
tags: ["AWS", "CloudFormation"]
---

While tagging resources in CloudFormation is straightforward, _conditionally tagging_ them is a little non-obvious and requires use of [conditions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html).

## Use case: tagging a release version
I wanted the ability to conditionally tag a Secrets Manager secret with a release version when the secret was deployed into production. For lower environments, I didn't care / want to specify a release version.

First, we define a parameter that will contain the release version:

```yaml
Parameters:
	ReleaseVersion:
		Type: String
		Description: The release version e.g. 1.2.3
		Default: ''
```

Next, we define a condition to easily check whether a non-default value was provided for the parameter:

```yaml
Conditions:
	HasNoReleaseVersion:
		!Equals [!Ref ReleaseVersion, '']
```

Finally, we tie it all together on the resource by conditionally setting the `release` tag depending on the evaluation of `HasNoReleaseVersion`:

```yaml
Resources:
	MySecret:
		Properties:
			Tags:
				- Fn::If:
					- HasNoReleaseVersion
					- !Ref AWS::NoValue
					- Key: release
					- Value: !Ref ReleaseVersion
```

The `AWS::NoValue` [pseudo parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html) will ensure the tag is not created unless a non-default value for the release version was provided.
Set github credentials in MontereyOS
Tags: git, github, gitlab, webdev
Published: 2022-04-26 22:58:51

## Set git username and email

First you need to set your username and email, in the terminal replace <USERNAME> and <EMAIL> with your own:

```
git config --global user.name "<USERNAME>"
git config --global user.email <EMAIL>
```

## Set SSH key

In your terminal type:

```
ssh-keygen -t rsa
```

Then it would ask some questions, you can skip all with <enter> or fill as you need.

Now you need to copy this SSH key to paste it on github or gitlab as you need:

```
cat ~/.ssh/id_rsa.pub | pbcopy
```

With this command you have your SSH key in the clipboard ready to paste it with <command> + <v>

## Add your SSH key in gitlab

First Logged in, then go to the right up corner and open the user avatar menu, then click on "settings", then go to the left sidebar to the section "SSH Keys", you are going to be able to see a form to add a SSH Key 

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

## Add your SSH key in github

Go to the right up corner, open the avatar menu, then go to settings, you are going to be able to see in the left sidebar a "SSH & GPG Keys" section, click there and you are going to be able to see all your SSH keys, and a green button to "add new SSH key", Here you can add your new SSH key.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpdo0z20agkrbrv6cfe6.png)
Google bots bringing me down - New Years Resolution - Dev Log 31
Tags: webdev, beginners, startup, programming
Published: 2022-04-26 22:58:28

The last week has not been too hot. Got to have lows to appreciate the highs though. While trying to start my Google Ads campaign for the job board, my account got flagged by a bot for suspicious activity. I thought okay no worries I will send an appeal of the suspension and get all of that sorted out. The appeal went no where and was not read by a real person. Instead I got an email saying that my account is suspended permanently at the user level, so do not try to make additional accounts. You can tell the email response was automated, no name at the bottom, no personal information used (not even "Hi, Lawrence"), and when you follow the links they just go to general documentation pages that do not actually help.

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

Obviously this is terrible news. I started to look into it and apparently I am not the only person having this problem. Many developers have had the same experience. Google Ads suspends their account for no reason, and they can not do anything about it because all of the support is automated. Here is a thread where many people like myself have commented on the problem, you have to scroll past the recommended solution, which if you read the posts, does not work.

https://support.google.com/google-ads/thread/7953006?hl=en

On a more personal note, I am now very sick. Luckily it is not COVID, but I do have an upper raspatory infection. I have just been chilling and using my time to rest, I can not seem to pick the project that I would like to pursue next. I like the ideas of a SaaS, a mobile game, and a social network. For now I am not too worried about it though. Just trying to get my health back before I start my next code grind.
My Resume Challenge
Published: 2022-04-26 22:31:02

Part 8 - Source Control & CI/CD
There is no git for this - Create a repo for yourself under your own account
13. Source Control
You do not want to be updating either your back-end API or your front-end website by making calls from your laptop, though. You want them to update automatically whenever you make a change to the code. (This is called continuous integration and deployment, or CI/CD.) Create a GitHub repository for your backend code.
14. CI/CD (Back end)
Set up GitHub Actions such that when you push an update to your Serverless Application Model template or Python code, your Python tests get run. If the tests pass, the SAM application should get packaged and deployed to AWS.
Empleos en Data y Analytics LATAM — Abr 2022 - IV
Published: 2022-04-26 22:15:11

Te compartimos las ofertas laborales del mes para áreas de Data, Analytics y Cloud 👨‍💻👩‍💻.

✅[Data Analyst- Suretouchleads (Perú, Lima)]
(https://pe.indeed.com/viewjob?jk=60bb898b9b3a7a44&q=Data+Analyst&tk=1g1jueubvr051800&from=web&advn=1367189867657127&adid=388562376&ad=-6NYlbfkN0D8z0tpsQEG_1knZNpMYuKO8sdOtMp3g7czmd-_UmlkXLcWRSC1DaA6FQzJjUjpVwkXLCXU60If_CLuNWlSfxWIQHPy5Xq4arj44tm0bz4i2Gv2psM62Aw6YRcKPT_AhJ_ensSJI-6IIqxOAij2-FFc2Vsom6cSzzaoQg3SwtMi9zU3Uf4hBNk-TmP7X0JeVDR80gpfDBr-1wdyhyZK6Hgpbtf5OQiPFK73RQi5JUuU69f1loLYdqfq1aHXWhyUmvvu-vxkiipXL3s_u4BsA7oJrH5nk1xDA4hJDaSgEctpZCheIQ57nRFATV1nTuxIO_O6FMU34US14rJl5xtRuGEBuvkjUAnFfHkfSLnMAs4S-N5jKaAnfQpr&pub=4a1b367933fd867b19b072952f68dceb&vjs=3)
✅[Data Engineer- Amadeus (Colombia, Bogotá)]
(https://co.indeed.com/viewjob?jk=78e8abcccbb87ed8&tk=1g1jugkliq6rf801&from=serp&vjs=3)
✅[Data Scientist - Banco Pichincha (Ecuador, Quito)]
(https://ec.indeed.com/viewjob?jk=6820b27eb9fa44bf&tk=1g1juhumeq6rf800&from=serp&vjs=3)
✅[Machine Learning Analyst - EY (Chile, Santiago de Chile)]
(https://cl.indeed.com/viewjob?jk=31b9cf7fb1b72a5c&tk=1g1juj2spghog800&from=serp&vjs=3)
✅[Data Analyst - Citi (Mexico, Ciudad de México)]
(https://mx.indeed.com/viewjob?jk=116c505c02f35a12&tk=1g1juk63pt5n9800&from=serp&vjs=3)
✅[Data Engineer- Toptal (Bolivia, Santa Cruz)]
(https://www.linkedin.com/jobs/view/2748042263/?eBP=NotAvailableFromMidTier&recommendedFlavor=SCHOOL_RECRUIT&refId=wl8tEAQ8DcMAmdPcQ2KEJg%3D%3D&trackingId=z6sQ7u1CiRwfvq4OZe%2BVlw%3D%3D&trk=flagship3_search_srp_jobs)
✅[Data Scientist - ExxonMobil (Argentina, Buenos Aires)]
(https://ar.indeed.com/viewjob?jk=c576cfba7206a2e8&tk=1g1jv0cesqt7u802&from=serp&vjs=3)
✅[Machine Learning - BairesDev (Venezuela, Caracas)]
(https://ve.indeed.com/viewjob?jk=c9c3d2edd96bb402&tk=1g1jv1fqfr069800&from=serp&vjs=3)


Aprende, aplica y crece en proyectos de Data y Analytics en Cloud.

Visita nuestra página:
👉🌐 datahack.la
Issue Deploying Rails 6.1 to AWS Elastic Beanstalk
Tags: ruby, rails, aws
Published: 2022-04-26 22:08:05

Any tips on deploying Rails to AWS Elastic Beanstalk ? I am starting to have real difficulty. Each error I solve leads to another one. Right now it has issue with compiling assets `warning: shebang line ending with \r may cause problems` , so I turned it off for now by changing one environment configuration as : `RAILS_SKIP_ASSET_COMPILATION = true` Now it is a database issue. I update things but each time it fails to deploy the newer version and keeps the old one running...
Custom CRM Development
Tags: webdev, javascript, opensource, devops
Published: 2022-04-26 22:02:59

[Custom CRM Development: InfotonicsMedia]
InfotonicsMedia provides custom CRM development services that assist organizations with the development, installation, migration, and maintenance of their custom CRM systems. If you are committed to growing and improving your customer interactions, we will apply our proven expertise and experience to create a completely configured CRM that is tailored to the characteristics of your niche and company needs. Our unique CRM systems will assist your company in increasing its productivity, gaining new customers while maintaining existing ones, improving ROI, organizing client-related processes, and more. As a consequence, you will have more insight into the intricacies of your client’s requirements, hence better outcomes and growth.

Outstanding feature options our custom CRM development services provide:

Dynamic Kanban Board
As a part of our custom CRM development, get an aesthetically appealing and ‘easy as drag and drop’ facility with our intuitive and dynamic Kanban board. Facilitate better insights by having a Kanban view of your workflow across entities and processes.
Quotation Template
You can automate your quote generation process with the help of our quotation template feature provided by our custom CRM development services. Create full-fledged quotes with your name, products, and prices all on your own with ultimate convenience.
Pricelist Manager 
Since it is custom CRM development, you can choose to include our CRM integrated price list management tool that helps you to create customized prices for individual customers or customer categories and offers analytics services to help sales teams determine the best pricing strategy and estimate the profitability of each sale, product line, customer category, etc.
Campaign Manager
Now take control of your marketing campaigns from your CRM system. Run and manage campaigns on multiple platforms, create a database, and set automatically triggered campaign activities to keep your customers engaged with our custom CRM development that designs products for your specific needs.
Lead Gathering
You may include this feature in custom CRM development to gather and collate your leads from multiple platforms like Facebook, AdWords, Justdial, and India Mart, all in one place. Stack them neatly, get your data organized, and have seamless navigation through your prospects, leads, and opportunities for better optimization of your leads.
Reporting 
Analyze the gigantic amount of data created, get to know your customer’s habits and interests, be abreast with the client status, and follow prospective customers by smartly generated data analyzed reports with this of our custom CRM development features.
Task Manager & Internal Communication
This custom CRM development feature helps you improve your team’s efficiency by better assigning and managing tasks utilizing follow-ups and reminders. Set up better communication channels digitally to resolve deadlocks and avoid communication gaps.

for more click here :- https://www.infotonicsmedia.com/custom-crm-development/