teleren/devto huggingface dataset:
Mock constants in Ruby tests
Tags: ruby, test, minitest
Published: 2022-06-23 14:41:44

Here's a quick and dirty way to mock class constants in unit tests without using any gems.

Given this class:

```
module Query
   class Paginator
     PAGE_SIZE = 1000
     
     def paginate(page:)
         offset = if page > 1
           per_page * (page.to_i - 1)
         else
           0
         end
         Person.order(:created_at)
               .offset(offset)
               .limit(PAGE_SIZE)
     end
   end
end
```

Given PAGE_SIZE is set to 1000 records, I think it's a bit of a lift to run a test with that much records so why not set the constant with a lower value in our tests?

```
module Query
   class PaginatorTest < ActiveSupport::TestCase
     setup do
        # We change the constant value
        Query::Paginator.send(:const_set, 'PAGE_SIZE', 1)
     end

     teardown do
       # We restore the original value to avoid issues with other tests
       Query::Paginator.send(:remove_const, "PAGE_SIZE")   
     end
  
     ...
   end
end
```

You can set and unset the constant value in the test case body as well.
AutoML-docker has been launched
Tags: programming, tutorial, opensource, github
Published: 2022-06-23 14:40:38

Today, we are launching a brand new and completely free open source tool in our lineup: AutoML-docker by kern. With this CLI-based tool, you can easily use our data to build containerized natural language classifiers in no time. Our mission at kern is to make the world of data and AI more straightforward and accessible. To aid you in your quest for building value from data, we’ve been working on an easy-to-use tool to create natural language classifiers automatically. The possibilities we aim to achieve to build high-quality AI solutions for our users are endless. #automl -docker is open to everyone, but we designed it to be especially useful for people new to machine learning, data, and AI. You can also check out our #Github repository or our youtube channel for a tutorial, where we explain everything step-by-step.

To learn more about our autoML tool check out our GitHub 👉🏼 https://github.com/code-kern-ai/automl-docker

Link to the youtube tutorial 👉🏼https://www.youtube.com/watch?v=IUFyCYE6cbc 

Subscribe to our newsletter 👉🏼https://www.kern.ai/pages/open-source and stay up to date with the release so you don’t miss out on the chance to win a GeForce RTX 3090 Ti for our launch 😊
when to chase and when to wait..
Tags: webdev, beginners, devjournal, programming
Published: 2022-06-23 14:40:12

From my point of view, there are moments in life where you must do the hard work. That being whatever it is you need to do to reach your life goals.. and by life goals, I include everything else outside of your professional life.
Sometimes it's a partner, or a new apartment. Changing cars or buying your very first. These things take time and specific resources. But aside from this, there are times in life where you need to WAIT and maybe you'll be lucky to rest. Take some time off, travel or invest in hobbies such as Cooking, investing in your body/health, learning to paint or anything that they bottled up while you were a little kid. THIS, is just as important and you shouldn't allow yourself to work your life away..
Simple health check for Keycloak
Tags: keycloak, monitoring
Published: 2022-06-23 14:26:58

> Today we will see how to add a simple and not intrusive health check based on shell script for your Keycloak

Sometime ago I did the (bad) experience to note the user sessions increase very faster without known reason on the main cluster.

The result of this was a rise of the user sessions which keep busy the CPU because we reached the maximum of heap memory occupation. More of 50k user sessions have been created on a dedicated Keycloak client by a health check probe a bit chatty 😇

_Lesson of the day, if you fine-tuned your token settings don't forget to login AND logout test users._

## A simple probe

The only prerequisite is to have `jq` command available on the environment where the script runs.

```shell
#!/bin/bash

login_access=$(curl -k -X POST \
   -H "Content-Type:application/x-www-form-urlencoded" \
   -d "grant_type=password" \
   -d "client_id=admin-cli" \
   -d "username=alive" \
   -d "password=[REDACTED]" \
 'https://keyclaok.company.com/auth/realms/[REALM]/protocol/openid-connect/token')

error=$(jq -r .error <<< $login_access)

if [ $error == "null" ]; then
    echo "Login successful for test user."
else
    echo "Unable to login test user ($error)."
    exit 1
fi

access_token=$(jq -r  '.access_token' <<< "${login_access}")
refresh_token=$(jq -r  '.refresh_token' <<< "${login_access}")

logout_response=$(curl -s -o /dev/null -w '%{http_code}' -k -X POST \
   -H "Content-Type:application/x-www-form-urlencoded" \
   -H "Authorization: Bearer $access_token" \
   -d "client_id=[CLIENT_ID]" \
   -d "refresh_token=$refresh_token" \
 'https://keycloak.company.com/auth/realms/[REALM]/protocol/openid-connect/logout')

if [ $logout_response -eq 204 ]; then
    echo "Logout successful for test user."
else
    echo "Unable to logout test user ($logout_response)."
    exit 1
fi
```

## Le me try it

https://gist.github.com/ulrich/aa04a793d54703998ecb015a0e2ff803

Crédit photo : https://pixabay.com/fr/users/jackmac34-483877/
How to be better at new feature planning?
Tags: help, discuss, productivity
Published: 2022-06-23 14:06:46

Hey everyone,

> TL;DR - Our team is struggling with good technical analysis and planning for new features added into the product, so we need some ideas to help refine our process.

Whenever there's a new feature or a big enhancement to be added into the product, many times we struggle with efficient analysis and planning. This in turn messes up the estimations, and we end up scrambling at the end of sprints either shuffling tickets around or stretching our work hours.

What I've suggested as a good starting point is to have a set of questions written down that cover the basic stuff common to most features or any new work in general. So, for any new feature request coming in from the clients, if we manage to get answers to these questions then at-least we have a good understanding of the LOE that's needed to get the work done, and also ease up the breakdown of big features into smaller tasks.

The clients thoroughly cover the business aspect of the requirements. We need some ideas to get better at the technical side of things. I've felt many times that during planning we are left wondering what should we do during planning, and it all ends up being a wild goose chase. This is the number one problem we want to address.

Also, how much time do you guys usually put into planning a new feature or a module. Eg: if at first glance, something looks like 3-4 days worth of work, than I think it's a good idea to put aside 2-3 hours where we can just brainstorm and think about all the teeny tiny details.

One last question, is it a good idea to have everyone on the team sit down during the planning meeting?

Thanks a lot in advance.
Day 3 : 100DaysOfSwift🚀
Tags: 100daysofcode, 100daysofswift, swift, ios
Published: 2022-06-23 14:03:54

## Day 3

## operators and conditions

Operators are special symbols that perform operations on variables and values.

1.Arithmetic Operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication.

```
let firstScore = 12
let secondScore = 4
```

Add And Subtract

```
let total = firstScore + secondScore
let difference = firstScore - secondScore
```
multiply and divided

```
let product = firstScore * secondScore
let divided = firstScore / secondScore
```

2.Compound assignment operator

```
var score = 95
score -= 5  //90
```
3.Comparison Operator
Comparison operators compare two values/variables and return a boolean result: true or false. For example,

```
var a = 5, b =2
print (a > b)      // true
```

```

Operator	Meaning 	Example
==	   Is Equal To 	        3 == 5 gives us false
!=	   Not Equal To 	3 != 5 gives us true
>	   Greater Than	        3 > 5 gives us false
<	   Less Than	        3 < 5 gives us true
>=	Greater Than or Equal To	3 >= 5 give us false
<=	Less Than or Equal To	        3 <= 5 gives us true
```

4.Logical Operators
Logical operators are used to check whether an expression is true or false. They are used in decision-making. For example,

```
var a = 5, b = 6
print((a > 2) && (b >= 6))    // true
```

```
Operator Example	  Meaning
&&       a && b	   Logical AND:true only if both the operands are true

||	a || b	   Logical OR:true if at least one of the operands is true
!	  !a	   Logical NOT:
true if the operand is false and vice-versa.

```

**Condition**
Example if else

```
let firstCard = 11
let secondCard = 10

if firstCard + secondCard == 21 {
    print("Blackjack!")
} else {
    print("Regular cards")
}

```

1. combining condition
Swift has two special operators that let us combine conditions together: they are && (pronounced “and”) and || (pronounced “or”).

Example

```
let age1 = 12
let age2 = 21

if age1 > 18 && age2 > 18 {
    print("Both are over 18")
}

if age1 > 18 || age2 > 18 {
    print("At least one is over 18")
}
```

**The ternary operator**
Example

```
let firstCard = 11
let secondCard = 10
print(firstCard == secondCard ? "Cards are the same" : "Cards are different")
```
**Switch statements**

```
let weather = "sunny"

switch weather {
case "rain":
    print("Bring an umbrella")
case "snow":
    print("Wrap up warm")
case "sunny":
    print("Wear sunscreen")
default:
    print("Enjoy your day!")
}
```
**Range operators**
Swift includes two range operators, which are shortcuts for expressing a range of values. The following table explains these two operators.
1.Closed Range
(a...b) defines a range that runs from a to b, and includes the values a and b.
Example:

```
1...5 gives 1, 2, 3, 4 and 5
```
2.Half-Open Range

```
1..< 5 gives 1, 2, 3, and 4
```
HackerRank — Problem Solving — JavaScript — A Very Big Sum
Tags: javascript, programming, problemsolving, hackerrank
Published: 2022-06-23 14:02:34


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

The task is to find and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.

**Solution:**

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

**Explanation:**

**Step 01:** Take one variable named "sum" and store an initial value as zero(0).

**Step 02:** Iterate a for loop through the given array.

**Step 03:** While iterating the array we are going to add the array element with the variable named "sum".

**Step 04:** Return the overall summation at the very end after iterating the whole array.
We are looking for a tech co-founder to work in SaaS
Published: 2022-06-23 13:58:03

Hey everyone!

I spent the last few months with my co-founder building a new advanced different solution for making forms and surveys.

For example, our Question Logic is far more advanced than Typeform, SurveySparrow, and all famous forms services. More details here: www.typesheet.net/logic

🔥 Plus we are working on a new major update with advanced Questions Builder.

👇
🤝 At the moment, we want to speed up development by inviting a Node.js developer with the mindset of an entrepreneur to join us as a co-founder.
👆

🤔 Why we don't hire freelancers?
We are already doing this, but the problem with freelancers is they can't think like the owners of the project. We have no issue with hiring and paying for freelancers, but it's not the best solution at this stage.

🤔 Who we are?
👉 Hamza as Vue.js developer. He works on the frontend side, talks to customers, and does some marketing when needed.

👉 I'm Ali, a UI/UX designer. I can also do marketing, talking to customers, and other useful stuff.

Both of us have previous experience in making products as indie hackers, but this time we want to build something unique and solve all issues in the forms builder exist today.

🚀 I'm confident we can finish, launch, and grow this product with another amazing co-founder.

So, if you are interested, then we are happy to have a zoom call to share more details. Just drop a comment. 😉
How to identify high-quality Ansible content?
Tags: ansible, automation, ansiblecollections
Published: 2022-06-23 13:53:05

**1. Check documentation**

At the very least, it should contain a quick-start tutorial with installation instructions and reference documentation for Ansible modules and roles.  

**2. Assess playbook readability**

Modules should have a consistent user interface and descriptive parameter names.  

**3. Test basic functionality**

Check the basic functionality of each Ansible module - enforcing state instead of executing actions and supporting check mode are the bare minimum.  

**4. Peek at the tests**

Checking the CI/CD configuration files should give you a general idea about the test suite’s robustness - you are looking for integration and sanity tests.  

**5. Inspect the issue tracker**

A large number of reported defects with no response from maintainers is a bad sign.
Split commands and options from CLI
Tags: node, programming, javascript, showdev
Published: 2022-06-23 13:49:13

Hi 👋

*This is a very small 1.33 KB package that does just one simple task to get the user's input data passed from your terminal, split it and send it back to and object, That's it, no big config or API just a tiny function.*

## Install
```js
npm i argv-user-input
```

## Usage 💡
```js
#!/usr/bin/env node
import parseArgvData from 'argv-user-input';
const argvs = parseArgvData();
```
*foo.js*


### With no commands or options.
```
$ foo.js 
```
```js
console.log(argvs);
/*
{
  commands: [],
  options: {},
}
*/
```

### With commands and no option.
```
$ foo.js start test
```
```js
console.log(argvs);
/*
{
  commands: ['start', 'test'],
  options: {},
}
*/
```

### With commands and options.
```
$ foo.js start test --skip -p ./dev
```
```js
console.log(argvs);
/*
{
  commands: ['start', 'test'],
  options: {
    skip: true,
    p: './dev'
  },
}
*/
```

### With option and no command.
```
$ foo.js --name=foo
```
```js
console.log(argvs);
/*
{
  commands: [],
  options: {
    name: 'foo'
  },
}
*/
```

Good code and have fun ✨

* https://lucastostee.com
* https://github.com/luctst
Authtrail providing a complete toolbox for Web3 developers. Join the Live AMA today to learn more.
Tags: webdev, productivity, blockchain, web3
Published: 2022-06-23 13:30:00

---
title: Authtrail providing a complete toolbox for Web3 developers. Join the Live AMA today to learn more.
published: true
description: thtrail providing a complete toolbox for Web3 developers. Join the Live AMA today to learn more.
tags: webdev,Productivity,blockchain,web3
cover_image: https://authtrail.com/wp-content/uploads/authtrail-ask-me-anything.png
---

Authtrail is hosting a new episode of the AMA (Ask Me Anything) series. Once again, all lights will be pointed at Authtrail’s CEO and co-founder Matjaz Sobocan.

Join Authtrail’s live AMA with Matjaz on June 23 at 5:00 pm UTC on our official [Telegram channel](https://t.me/Authtrail) to catch some revealings and inputs from the Web3 space at large.

Read more [here](https://authtrail.com/blog/june-ama-with-matjaz-sobocan/).
Link: When You Should Prefer Map Over Object In JavaScript
Tags: javascript, hashmap
Published: 2022-06-23 13:27:10

---
title: Link: When You Should Prefer Map Over Object In JavaScript
published: true
description: 
tags: javascript,hashmap
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

Thorough breakdown of Object vs Map in JavaScript.

https://www.zhenghao.io/posts/object-vs-map
AWS #AppConfig Helps you to deploy your Application Configuration Effectively.
Tags: aws, configuration, application, appconfig
Published: 2022-06-23 13:22:56

AWS AppConfig help you to Configure, validate, deploy feature flags and application configuration.

Benefits of AWS AppConfig
1. Move quickly and safely by using feature flags and dynamic configuration.
2. Validate configuration before you deploy to avoid costly errors.
3. Monitor configuration, and automatically rollback if needed.

There are various use cases such as Feature flags, Operations tuning & Allow-listing or block-listing.

Get hands on AWS AppConfig Workshop to get started Via https://lnkd.in/dnAmQ8wc
Learn more about AWS AppConfig Documentation https://lnkd.in/dnJwHKFX

Click on the below video and learn more about AWS APPConfig
https://youtu.be/rL_e6W6SlMM
Fusion Charts | Made with Vue JS
Published: 2022-06-23 13:19:06

![Fusion Charts | Made with Javascript | Vue JS](https://res.cloudinary.com/madewithjavascript/image/upload/v1655612013/large_fusion_charts_made_with_vue_js_9eb412caae.png "Fusion Charts | Made with Javascript | Vue JS")


### Easiest JavaScript charting library for web & mobile

> JavaScript charts for web and mobile apps. 95+ chart types, 1400+ maps and 20+ business dashboards with pre-built themes for any business use-case. Build fast, responsive and highly customizable data visualizations trusted by over 28,000 customers and 750,000 developers worldwide.
> 
> ### Build beautiful web & mobile dashboards
> With our interactive and responsive charts, extensive documentation, consistent API, and cross-browser support - your next great dashboard starts here!
> 
> ### 100+ Interactive Charts & 2,000+ Data-driven Maps
> Get all the variations of popular charts like Bar, Column, Line, Area, and Pie; or domain-specific charts like Treemaps, Heatmaps, Gantt Charts, Marimekko Charts, Gauges, Spider Charts, Waterfall Charts, and many more! In addition to charts, we also have over 2000+ choropleth maps which cover countries, counties and even cities!

## Check out more such amazing projects on our website

[Made with Javascript](https://madewithjavascript.club)

## Want us to feature your project

[Submit your Project to Made with Javascript](https://madewithjavascript.club/submit-project)


You can also write to us for any of your queries at:

[Email Made with Javascript](mailto:madewithjavascript@gmail.com)

## Project already shared on our social media handles.

| SocialMedia | SharedLink |
| ----------- | ---------- |
| Twitter | [Fusion Charts on Twitter](https://twitter.com/withjavascript/status/1539959864369319936?s=20&t=tvUQCVfAs8W52vZqD_0Vfg)
 |
| Medium | [Fusion Charts on Medium](https://medium.com/@madewithjavascript/fusion-charts-made-with-vue-js-53db19494ea3)
 |
| Facebook | [Fusion Charts on Facebook](https://www.facebook.com/madewithjavascript/posts/pfbid02XqPhpfBTYhoyea1cdEdugQUyz4RJxUcpH5ceqNkg3moBb4GeYz182G5GWbuBeS3rl)
 |
| Tumblr | [Fusion Charts on Tumblr](https://www.tumblr.com/blog/view/madewithjavascript/687855643761278976?source=share)
 |
| LinkedIn | [Fusion Charts on LinkedIn](https://www.linkedin.com/posts/madewithjavascript_fusion-charts-made-with-vue-js-easiest-activity-6945725654793416704-u2VU?utm_source=linkedin_share&utm_medium=member_desktop_web)
 |
| Pinterest | [Fusion Charts on Pinterest](https://pin.it/5NNMdCw)
 |


Filled Under:

 - [Made with Javascript](https://madewithjavascript.club)
 - [Made with Vue JS](https://madewithjavascript.club/categories/vue-js)

Make sure to give this post ❤ 50 ❤ hearts, click the 🦄 unicorns 🦄 and follow 👉 @madewithjavascript 👈 for more such awesome showcases. Show you love for the people who have worked so hard!
Let's take a look at the new pages in dbForge SQL Complete!
Tags: dbforge, sqlcomplete
Published: 2022-06-23 13:16:28

---
title: Let's take a look at the new pages in dbForge SQL Complete!
published: true
description: 
tags: dbforge, sqlcomplete
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
These pages help you to:
- understand SQL Server SELF JOIN By Practical Examples: https://www.devart.com/dbforge/sql/sqlcomplete/self-join-in-sql-server.html
- learn how to use the CASE Statement in SQL Server: https://www.devart.com/dbforge/sql/sqlcomplete/sql-case-expression.html
- read about SQL Server INNER JOIN Clause: https://www.devart.com/dbforge/sql/sqlcomplete/sql-inner-join-statement.html
- find the practical examples of SQL CROSS JOIN: https://www.devart.com/dbforge/sql/sqlcomplete/sql-cross-join.html

✅ Download a 14-day absolutely free trial of our dbForge SQL Complete: https://www.devart.com/dbforge/sql/sqlcomplete/download.html
My experience with scrimba
Published: 2022-06-23 13:03:53



![scrimba picture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/343z43oziv53izpcebyk.png)
I graduated from university in IT 8 years ago and right after my graduation, I started working in other fields, but I always coded, I could do a little backend a little frontend a little system programming but I always felt that my arsenal of skills is not deep enough to work in IT but now after 8 years, I decided to give web development a go and sharpen my skills to be good enough, so I decided to find an online course that teaches web development.
after searching through thousands of online courses and classes I stumbled across scrimba through react's official website.
I checked scrimba and I really liked the way they thought about developing apps.
the very first thing that you recognize which is different from other courses is the platform and online editor.
scrimba's platform is designed in a way that as the teacher teaches, you can pause and interactively change the code and run it on the same page that you are watching the course.
this feature give the scrimba teachers the ability to teach as scrimba advertises "You as student write the code, not us"
another good point of scrimba which is not unique to scrimba is comprehensiveness, they have a course for frontend development which is from zero to good enough, and many other courses that make you a better programmer and ready for a job.
the teachers in scrimba teach comprehensively and patiently one subject at a time and they add repetition in their courses which is very useful.
before scrimba I used to search for everything in google and copy from StackOverflow now I feel like, with scrimba I got much better at remembering codes when I need them.
but there are some minor problems with scrimba, one is the situation with countries that are under united states sanctions and one of those countries is my country Iran I tried to pay for pro courses but since the banks of Iran are not supported throughout the world I couldn't do it, in my opinion, if scrimba added a cryptocurrency payment this problem would be solved.
one other problem is the way they calculated the purchasing power of Iran, in their payment page they miscalculated the Iranian Rial's ratio to USD. 
this miscalculation is not unique to scrimba many other places on the internet are making this mistake, which every dollar is 40000 Iranian Rial,  in reality, every 300000 Iranian Rial Is one dollar
there are a lot of other things about scrimba but I feel this post got too long.
a long story short SCRIMBA IS GOOD