teleren/devto huggingface dataset:
Using what i learned this week about tests, to help with another Open Source Project
Published: 2022-11-12 21:43:08

This week I wrote a blog post about how I added tests to my Static site generator. this was the first time I was working with tests and I was using python. This week however I was working with a repo that I worked with during Hacktober fest.

# [cuttle](https://github.com/cuttle-cards/cuttle)

This repo was where I made my last Hacktober fest contribution and found a community that was very welcoming and helpful. I decided to work with them again because I enjoyed my experience last time.

# What I did

[Issue #163](https://github.com/cuttle-cards/cuttle/issues/163)

This issue was about making it so the season leaderboards didn't show seasons that have yet to happen so they can add the future seasons all at once rather than adding them after the season is over.

[Pull Request](https://github.com/cuttle-cards/cuttle/pull/209)

Initially, I was fixing the find query where it searches all of the seasons so I added a where clause and a less than sign so it would filter out future seasons. This worked however it broke the tests for the leader boards, and they asked me to add a test to show that future leader boards aren't being shown.

To fix this I needed to learn about how the tests were conducted. The testing framework they were using was [cypress](https://www.cypress.io/) a javascript testing framework. So first I edited the file with the season stats and the start date. After that, I figured out that I needed to change my less than to less than or equal to because it didn't include the first date. After fixing that I added my test where it tried to select the season that will always be a year in the future but it will never be available.

# What did I learn

I got to have more practice with tests and got to try and use them on another language.
zeros | SPVM::Numpy - The Project for Python/NumPy Porting to Perl
Tags: perl, spvm, python, numpy
Published: 2022-11-12 21:42:50

The <code>zeros</code> method in the <a href="https://github.com/yuki-kimoto/SPVM-Numpy/blob/master/lib/SPVM/Numpy.spvm">Numpy</a> class is implemented.

```
use Numpy;
my $np = Numpy->new;

my $x = $np->zeros;
```

## How to install SPVM::Numpy

```
cpanm SPVM::Numpy
```

```
# Developper
cpanm SPVM;
git clone https://github.com/yuki-kimoto/SPVM-Numpy.git
```

See also <a href="https://dev.to/yukikimoto/installing-spvmnumpy-pythonnumpy-porting-to-perl-4hfi">Installing SPVM::Numpy</a>

## What Is SPVM?

<a href="https://metacpan.org/pod/SPVM">SPVM</a> is a static typed language that can be used from <a href="https://perldoc.perl.org/">Perl</a>. <a href="https://metacpan.org/pod/SPVM">SPVM</a> is the essential part of the Python/numpy porting to Perl. If you haven't heard of Perl's SPVM. Please see also <a href="https://metacpan.org/pod/distribution/SPVM/lib/SPVM/Document/Language.pm">SPVM Language Specification</a>. 

## How potential dose SPVM have?

Growth is expected in the fields of Bio Tech, AI/ML, Apple/iPhone/iPad Apps, Google/Android Apps, IoT Device, Connected Car, Smart Device, Smart Home, etc.

This is because SPVM can produce an executable file that supports cross platforms and make easy to calculate arrays and bind C/C++ and Nvidia/GPU/cuda.

## SPVM Documents

- <a href="https://metacpan.org/pod/SPVM">SPVM Documents</a>

## SPVM Modules

- <a href="https://metacpan.org/pod/SPVM::Sys">SPVM::Sys</a>(<a href="https://github.com/yuki-kimoto/SPVM-Sys">SPVM::Sys on Github</a>)

## This project really needs contributors, sponsors, investors.

This project really needs contributors. I am looking for contributors, sponsors, investors.
VueJs Beginners part 4 - Component 2
Tags: vue, javascript, webdev, beginners
Published: 2022-11-12 21:09:25

I started learning VueJs and tend to share it with you step by step. Slowly, but steadily.

In this episode, we are going to continue Component topic in a different way.

Actually we want to create a new project with [Vue CLI](https://cli.vuejs.org/) and add a component afterwards. 

What you need to it so
1- Install vue cli 
```cli
npm install -g @vue/cli 
# OR
yarn global add @vue/cli 
```
2- Create a new project
```cli
vue create my-first-project
# OR
vue ui
```

Here we go, now let see to the layout of a component

## Basic layout of a component 
Components include a **template** for markup, logic including any **state/data/methods** as well as the **style** for that component.

```vue
<template>
  <h1> {{title}}</h1>
</template>

<script>
export default {
  props:{
    title: string,
  },
}
</script>

<style scoped>
h1 {
  color: #00FF00;
}
</style>
```
that's it, we defined a component and we can save and import it in other components.
we can also pass "props" into a component 

```vue
<Header title="First component" />
```

as we saw in part 3, a component can have **state** to determine how specific it behaves and what data is displayed. 

Some state may be either **local**  or **global**

- **Vuex** is a state manager for global state in larger applications ( if you come from react it's like Redux)

let's create a real example and define a component. this example aims to load a random user (name and avatar) and it's going to be defined as a separate component.

let's play with it and check the code. 
{% embed https://codesandbox.io/embed/vuejs-beginners-part4-component-2-en0i1g?fontsize=14&hidenavigation=1&theme=dark %}

If you check the codes you will notice how it looks simple and readable, let me know if you have any questions in the comments. 


Vue 3 has the composition API, which amis to resolve code reusability and readability, mostly in larger applications.

I will writing a separate post to demonstrate the composition API.

right now we are working the traditional options API (Vue 2 & Vue 3) that may you see more.

hope you find this post useful
all the best till next part
HASH
How waking up early help you to became a better developer.
Tags: webdev, productivity, career, discuss
Published: 2022-11-12 21:08:35

Wake up early it's a good habit which helps you to boost your personal development fast.
 the importance of waking up early is enormous. we can't state all of them in this article. but we will determine how this habit will impact your career as a developer.


**- Waking up early will increase your productivity.**
when you start your day by waking early your brain is active and creative. your projects or works you will start at this time will be professional and creative.


**- waking up early will save your healthy:**
when you wake up early, you have enough time to exercise, prepare a healthy breakfast, breathe fresh air, and read your favourite books. by doing these things, you'll save your body and mind.


**- waking up early will achieve your goals:**
waking up at 5 am is the best time to do the hard things of your goal because you have powerful energy at this time.


**- waking up early will increase your confidence.**
Confidence is built by small and consistent steps. when starting your day with wake up early and taking small decisions. you lead yourself to make big decisions which increase your self-confidence


wake early is the best habit you should do but isn't easy, it needs a lot of courage, energy and continuity
The Everyday Life of an HNG Intern; Isaac Ojerumu’s Story.
Tags: beginners, programming, tutorial, career
Published: 2022-11-12 20:55:17

**Task 1**
Interns of the HNG internship are grouped according to their niche. Isaac, a backend developer, was grouped into the Backend Track.
On the 27th day of October 2022, each track was presented with its task which was to be submitted by noon on the 29th day of that same month. The task awarded to members of the backend track was to set up a server (Host). This was carried out by team members, individually.  The organizers also did well to furnish the members with materials that would aid them in accomplishing their task; https://www.w3schools.com/ and https://www.freecodecamp.org/
Before making any attempt to carry out the task, Isaac studied the recommended materials, which I stated earlier. This gave him a clearer view of the task at hand. Isaac used PHP, by choice, in creating an API endpoint;

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49wve2602wdh0y6zf5dh.jpg)
 
This can also be done using other programming languages like Java, Python, C#, and the like. An API is a code or set of rules that enable two software programs to share resources, while the endpoint is a component of an API.
Isaac made use of a live web host which he purchased from https://domainking.ng, a web hosting service provider. This is necessary as it gives the server the ability to host several endpoints.
In carrying out the task, the tools used by Isaac were Visual Studio Code; a code editor that he used to write the code, and Postman; used in testing the endpoints.
A challenge that one can face in setting up a server is getting hold of a web server, as it can most times be costly However, this can be avoided by obtaining a free server from service providers like https://www.heroku.com/.
 Interns that were successful in completing the first task progressed to the next stage.
 I hope you find this inspiring and educational. See you in my next post. Bye for now.

Link to the next episode: https://dev.to/zadazini/the-everyday-life-of-an-hng-intern-isaac-ojerumus-story-2dm6
The Top Hacking Method for Social Media Accounts
Tags: cybersecurity, cybercrime, phishing, hacking
Published: 2022-11-18 04:24:10

---
title: The Top Hacking Method for Social Media Accounts
published: true
date: 2022-11-12 20:54:36 UTC
tags: cybersecurity,cybercrime,phishing,hacking
canonical_url: https://medium.com/the-gray-area/the-top-hacking-method-for-social-media-accounts-eab748cf9cd1
---

[![](https://cdn-images-1.medium.com/max/2600/0*VCaq-7mb3p53WpUQ)](https://medium.com/the-gray-area/the-top-hacking-method-for-social-media-accounts-eab748cf9cd1?source=rss-79a7fbf51e21------2)

TL;DR- People are always talking about social media accounts being compromised, but what’s really getting hacked? Most often, it’s the…

[Continue reading on The Gray Area »](https://medium.com/the-gray-area/the-top-hacking-method-for-social-media-accounts-eab748cf9cd1?source=rss-79a7fbf51e21------2)
dev.to codes! Collaborative coding experiment: The most liked comment picks the next line of code, day 5
Tags: community, opensource, programming, ruby
Published: 2022-11-12 20:52:21

Welcome to day 5! I think we're passt the next "line" of code, so we'll use the most liked "piece" of code from here on. Not an issue, though. Congrats to @rafaelhashimoto for picking this large snippet. I had to adjust it a bit to fit the previous code.

his experiment is inspired by a [post on the ProgrammerHumor subreddit](https://www.reddit.com/r/ProgrammerHumor/comments/yot55f/the_most_upvoted_comment_picks_the_next_line_of/), where the original author did this exact thing: The most liked comment after 24 hours picks the next line of code.

**The rules:**

 * Nothing that's against any applicable law
 * Nothing that's against the community code of conduct, terms of use, or privacy policy
 * No leaking of personal information of anyone
 * No malware/ransomware/viruses/etc.
 * Keep it civil
 * (To be expanded, depending on the case)

Our code so far:

```ruby
emotions = ["🥲", "🥰", "🥺", "😫", "🤬", "😞", "😅", "😊", "😰"]
how_i_feel_right_now = emotions.sample
if how_i_feel_right_now === "😊"
    letsDoThis()
end
def letsDoThis
  # things a person can do that will change his humor
  what_have_i_done = "🥲" if big_mistakes
  how_i_feel_right_now =  what_have_i_done
end

def big_mistakes
  deploy_on_friday() || buy_twitter()
end

def buy_twitter
  raise AquisitionError, "I won't buy it" if user_base_has_bots?
rescue AquisitionError => e
   puts e.message
   true # because you can't step back
end

def user_base_has_bots?
  true # well... yes
end
```

(I had to adjust the code a bit for it to be valid Ruby.)

See you in 24 hours!
Better call <Saul> Generator
Tags: html, css, javascript, beginners
Published: 2022-11-12 19:08:19

<img src="https://user-images.githubusercontent.com/48219965/201473196-52f61a36-dc09-4eb6-b39c-d9215d63432f.png" width="400"/>

Found out that the fonts from the [Better Call Saul](https://en.wikipedia.org/wiki/Better_Call_Saul) intro are free to use, so I played a bit with some CSS and HTML to mock it.

Added some JS so the users can insert any name they like instead of "Saul".

Also added animation to make the VHS grain effect.

[Code](https://github.com/or-yam/better-call)
[Live Demo](or-yam.github.io/better-call/)
Word Ladder
Tags: leetcode, python
Published: 2022-11-12 18:05:00

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

Every adjacent pair of words differs by a single letter.
Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
sk == endWord
Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

```py

class Solution:
    def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
        
        s = set(wordList)
        l = list("abcdefghijklmnopqrstuvwxyz")
        
        queue = deque([])
        queue.append([beginWord,0])
        
        while queue:
            a, b = queue.popleft()
            if a == endWord:
                return b + 1
            for j in range(len(a)):
                for i in l:
                    if (a[:j] + i + a[j+1:]) in s \
                    and (a[:j] + i +a[j+1:]) != beginWord:
                        s.remove(a[:j]+i+a[j+1:])
                        queue.append([a[:j]+i+a[j+1:],b+1])
        
        return 0
    
    
        
        
        
    
```
How to Render React with express.js together
Tags: webdev, javascript, express, react
Published: 2022-11-12 17:57:34


Hi guys, this is a way to run the react and express in a single server and a static way

1. Create a react project and write your code.
2. Create an express project.
3. Run the express project.
4. Link the express backend with react and build.
5. Set the react project build folder as static in the express.
6. And re-run the express project.

 ```
 app.use(express.static(path.join(__dirname, 'build')))
 ```


**working**
The react project will be bundled together through the build. And it will contain an HTML file so the HTML file will be rendered when the express project run. So the HTML file will available for the end user and
✨Atlas Hackathon22: Space Talks - MERN✨
Tags: atlashackathon22, mongodb, javascript, database
Published: 2022-11-12 17:19:29

## Built Space Talks ✨

This is my 1st hackathon 💯🤞.
 
Share Your Thoughts, Knowledge and whatever You like or know About Galaxies, Stars, Space, Planets, etc... 🌍✨🌚


### Category Submission: MERN Stack


### App Link
[Live Space Talks](https://space-talks.netlify.app/)


### Screenshots

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


![Image 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3bfip10hb2msieosu0b9.png)



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




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

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


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




### Description
 
My MERN Project 😄

This Beautiful web App **Space Talks**  I created with React js. 
I want you all to share Your knowledge and the facts you know about space. 
Feel free to share your knowledge regarding Space, Our Planet Earth, Stars, Moons, Planets.

Steps To follow:
1. Let The page loading complete
2. Check What other peoples have posted 
3. If found interesting click on sign-in button and sign-in with google account. 
4. Post something that people don't know  regarding space, galaxies, universe, stars, etc.
5. You can Add Image as well as small gifs 

### Link to Source Code
Feel free to fork my repo: 
[Source Code - ClientSide](https://github.com/Yashkapure06/space-talks-client)

[Source Code - ServerSide](https://github.com/Yashkapure06/space-talks-server)

### Permissive License
MIT

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


## Deployment

1. Netlify for front-end hosting
2. Heroku for back-end hosting 

## Background

I am always curious to know what all things happen in space some facts about space, some newborn stars, planets, black hole, etc ... So I thought lets create one kind of forum where anyone who loves about space would share his/her knowledge with the world.
And finally, I created this **Space Talks**.


### How I built it

Yes while working with MongoDB Atlas I got to know about how to integrate MongoDB with my react application from making simple react app to creating fully functional **MERN Application**.

### Additional Resources/Info

1. [Reactjs Docs](https://reactjs.org/docs/getting-started.html)
2. [MongoDB](https://www.mongodb.com/)
3. [MUI](https://mui.com/)
Memoization in Scala
Tags: scala
Published: 2023-01-06 02:57:42

---
title: Memoization in Scala
published: true
date: 2022-11-12 16:49:51 UTC
tags: Scala
canonical_url: https://brandonrozek.com/blog/memoization-scala/
---

In a [recent post](/blog/corecursion-unfold-infinite-sequences/), I talked about how corecursion is a great solution for removing redundant calculations. However if we’re sticking to a recursive approach, one way we can reduce redundancies is to use memoization. The idea here is that we save prior computations in some data structure and refer to them if requested.

[Pathikrit on StackOverflow](https://stackoverflow.com/a/36960228) provided a great solution for Scala using hashmaps:

```
import scala.collection.mutable
def memoize[I, O](f: I => O): I => O = new mutable.HashMap[I, O]() {self =>
  override def apply(key: I) = self.synchronized(getOrElseUpdate(key, f(key)))
}

```

If the input is already a key in the hashmap, then we return its value. Otherwise we calculate the output via `f` and update the hashmap.

Now lets memoize say the Fibonacci sequence

```
val fib : Int => Int = memoize {
    case 0 => 0
    case 1 => 1
    case n => fib(n - 1) + fib(n - 2)
}

```

Calling `fib(5)` returns `5`. However, we can also see the saved computations by analyzing the hashmap `fib`.

```
HashMap(0 -> 0, 1 -> 1, 2 -> 1, 3 -> 2, 4 -> 3, 5 -> 5)

```
Hide credentials in spring boot
Tags: java, springboot, security
Published: 2022-11-12 16:39:43

Spring boot make it easy to create spring applications. It makes it easier and faster to set up, configure and run the web application. When I was working on one of the projects, I was required to use some credentials. But I can't use it directly in the code. It should be hidden and still accessible in the code. We know that we can add the variable in the application.properties file and then use it in the java code. But I was not ablw to find how can add the env variable in a file and then access it in the application.properties file. If variables can be added in a file and accessed in the application.properties then the file can be included in the gitignore, and code can be pushed to github and shared with others without exposing the credential. 

So I did research and find out that we can import a file in the application.properties and use the variables. We are going to use the env.properties file to save the credentials. Create a env.properties file. I created this file in the resources folder, so that I can easily access in the application.properties.

![folder to save the env.properties](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lks00ax9mx84sahfva87.png)
Add some credentials in the env.properties file like

```
DB_USER=name_of_sql_db_user
DB_DATABASE_NAME=name_of_database
DB_PASSWORD=database_password
GOOGLE_API_KEY=google_api_credential
```
These are the secret info and can't be shared with everyone. But it is required to connect with the database server or to use the google service.

Now to access these variables in our java file, we have to import these variables in the application.properties file. Import the env.properties file so that we can get these variables in the application.properties file.

```
spring.config.import = env.properties
spring.datasource.username = DB_USER
```

env.properties file is in the same folder with the application.properties so it can be imported directly using the file name. We are telling the code to use the config from the import file i.e from env.properties.

Now to make sure that the credentials is not commited and pushed to github, we have to make sure that env.properties file is included in .gitignore.

```
/src/main/resources/env.properties
```
EMAIL VALIDATION
Published: 2022-11-12 16:10:45

`const regex = /\S+@\S+\.\S+/

console.log(regex.test("miraj@gmailcom"))

const data =/[a-zA-Z0-9._-]{3,}@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,4}/

const email ='mirajhadish49@gmail.com'

console.log(email.match(data)? 'yes':'no');`
Best Free Web Hosting Services
Tags: devops, webdev, javascript, beginners
Published: 2022-11-12 15:27:25



In this post, we will see some of the top places to host your application or website for free and some of the paid ones.

Disclaimer: The BaaS Providers here are not mentioned in any order. All of them have their positives and negatives

## Vercel

![](https://digitalpress.fra1.cdn.digitaloceanspaces.com/au0p5eq/2022/11/download.png)

Backed by the creators of the [Next.js](https://nextjs.org/) framework. It's one of the best places to host your [Jamstack](https://jamstack.org/')applications

They have a generous free tier that is enough for most of the hobby projects

## Netlify

![](https://digitalpress.fra1.cdn.digitaloceanspaces.com/au0p5eq/2022/11/meta-image.jpg)

[Netlify](https://www.netlify.com/) is a remote-first cloud computing company that offers a development platform that includes building, deploying, and serverless backend services for web applications and dynamic websites

## Google App Engine

![](https://digitalpress.fra1.cdn.digitaloceanspaces.com/au0p5eq/2022/11/unnamed.jpg)

[Google App Engine](https://cloud.google.com/appengine) is a cloud computing platform as a service for developing and hosting web applications in Google-managed data centres. Applications are sandboxed and run across multiple servers

## Heroku

![](https://digitalpress.fra1.cdn.digitaloceanspaces.com/au0p5eq/2022/11/3wgIDj3j_400x400.png)

[Heroku](https://www.heroku.com/) is a cloud platform as a service supporting several programming languages. One of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language, but now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go.

Note:- Their free tier is ending on 28th November 2022. Learn more about this in this [post](https://blog.heroku.com/next-chapter)

## Railway

![](https://digitalpress.fra1.cdn.digitaloceanspaces.com/au0p5eq/2022/11/68747470733a2f2f7261696c7761792e6170702f6272616e642f6c6f676f2d6c696768742e706e67--4-.png)

[Railway](https://railway.app?referralCode=thegogamicblog) is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy it to the cloud. This is one of my personal favourites as they offer $5  free credit every month to use on their platform

P.S:- [Vultr](https://www.vultr.com/?ref=9086643-8H)(Get a $100 credit by registering using this link) is an excellent hosting choice if you're looking for a VPS server-level hosting wherein you can manage it yourself

Thank you for reading :)