teleren/devto huggingface dataset:
377. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-08-05 05:32:52

```
class Solution {
 public:
  int combinationSum4(vector<int>& nums, int target) {
    vector<unsigned long long> dp(target + 1);
    dp[0] = 1;

    for (int i = 1; i <= target; ++i)
      for (const int num : nums)
        if (i >= num)
          dp[i] += dp[i - num];

    return dp[target];
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
Release 0.26.0 of Spellcheck (GitHub) Action - a maintenance release updating core component
Tags: release, opensource, githubaction
Published: 2022-08-05 05:30:03

---
title: Release 0.26.0 of Spellcheck (GitHub) Action - a maintenance release updating core component
published: true
description: Yet another maintenance release
tags: release, opensource, githubaction
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
Over the summer PySpelling has been updated to version 2.8, due to minor issue it was swiftly followed by 2.8.1. See the [release history for PySpelling](https://github.com/facelessuser/pyspelling/releases)

This release of the [GitHub Spellcheck Action](https://github.com/marketplace/actions/github-spellcheck-action) bumps the version of PySpelling from version 2.7.3 to version 2.8.1 so we are  up to date.

Even though the releases of the action, might trigger several PRs via Dependabot etc. I believe that it is better to make baby steps, when maintaining and releasing this software.

Two more improvements are shaping up, more on this, when they are ready.

The 0.15.0 and 0.16.0 versions are [announced to be sunsetted](https://github.com/rojopolis/spellcheck-github-actions/discussions). 

The idea of moving to a less frequent release cycle and a 1.0.0 release is also moving closer, with the project maturing.

Please feel free to open issues and/or PRs, all contributions are welcome.

## Change log for release 0.26.0

- The core component PySpelling has been updated from version 2.7.3 to version 2.8.1, see the [release history for PySpelling](https://github.com/facelessuser/pyspelling/releases)
3 open source tools to build your apps fast
Tags: programming, webdev, beginners, javascript
Published: 2022-08-05 05:23:00

**Under the Hood**
I was covering a youtube video for this story so thought of sharing the article on the same. But if you want to watch instead of reading below is the link.

[Video link](https://www.youtube.com/shorts/zimvcuJoMbg)

**Firebase**
Open source tool to create your backend services instantly. Firebase provide -

- Authentication,
- Storage,
- Realtime Databases,
- Analytics,
- In-app messaging
Firebase takes care of your backend infrastructure single handly.

## Supabase
Supabase claims himself as the Firebase alternative. They provide

- Instant APIs,
- Authentication,
- Storage &
- Realtime subscriptions.
Supabase deals with PostgressQL and works with tables instead of NoSQL databases like Firebase

## Appwrite
Open source backend servers for web, mobile and flutter developers. App write provides —

- Authentication,
- Databases &
- Storage
Appwrite provides all core APIs for your backend services to build applications fast.

**Conclusion**
Until next time, have a good day.

Keep developing!!

Our website [iHateReading](www.ihatereading.in) || [Youtube](https://www.youtube.com/channel/UC6I-Tz6QwYbJpoIK7l0NtXA) || [Twitter](https://twitter.com/treyvijay)
Hire+Plus! For Employees Here's how I built it (Redux - Job)
Tags: react, webdev, programming, tutorial
Published: 2022-08-05 04:47:00

Purpose: The candidate will be able to view jobs and view single job details.

## Types, Actions, and Reducers: Job State

### Types
**inside `app > features > job > jobTypes.ts`**
Data types for a job.

```json
export type JobData = {
	id: string;
	companyName: string;
	position: string;
	location: string;
	salary: string;
	datePosted: string;
	jobType: string;
	applyUrl: string;
	description: string;
};
```

---

### Actions
**inside `app > features > job > jobSlice.ts`**
The initial state for `job` reducer. `getPostedJobs` gets all jobs from DB and returns the stringified version. `getPostedJobById` gets one job by `id` and returns the stringified version of one job.

```javascript
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import { getJobById, getJobs } from '../../../utils/firebase/firebase.utils';
import { JobData } from './jobTypes';

interface jobState {
	jobs: JobData[];
	isLoading: boolean;
}
const initialState: jobState = {
	jobs: [],
	isLoading: false,
};

export const getPostedJobs = createAsyncThunk('job/getJobs', async () => {
	const jobs = await getJobs();
	return JSON.stringify(jobs);
});
export const getPostedJobById = createAsyncThunk(
	'job/getJobById',
	async (id: string) => {
		const jobs = await getJobById(id);
		const [jobObj] = jobs;
		return JSON.stringify(jobObj);
	}
);
```

---

### Reducer
I handled the response states and set the state accordingly.

```react
const JobSlice = createSlice({
	name: 'job',
	initialState,
	reducers: {},
	extraReducers: (builder) => {
		builder
			.addCase(getPostedJobs.pending, (state) => {
				state.isLoading = true;
			})
			.addCase(getPostedJobs.fulfilled, (state, action) => {
				state.isLoading = false;
				state.jobs = JSON.parse(action.payload);
			})
			.addCase(getPostedJobs.rejected, (state, action) => {
				state.isLoading = false;
				console.log('error with jobs', action.error);
			})
			.addCase(getPostedJobById.pending, (state) => {
				state.isLoading = true;
			})
			.addCase(getPostedJobById.fulfilled, (state, action) => {
				state.isLoading = false;
				state.jobs = JSON.parse(action.payload);
			})
			.addCase(getPostedJobById.rejected, (state, action) => {
				state.isLoading = false;
				console.log('error with getting job by id', action.error);
			});
	},
});

export default JobSlice.reducer;
```

That's all for the job/redux portion of the project, stay tuned!
206. Reverse Linked List[Leetcode][C++]
Tags: cpp, algorithms, leetcode, programming
Published: 2022-08-05 04:07:00

**_All suggestions are welcome. Please upvote if you like it. Thank you._**

---

[Leetcode Problem Link: 206. Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)

---

_**Using Recursion:**_
```javascript
class Solution {
public:
    ListNode* reverseList(ListNode* head) {
        if(!head || !head->next)
            return head;
        ListNode *ptr=reverseList(head->next);
        head->next->next=head;
        head->next=NULL;
        head=ptr;
        return head;
    }
};

```

**_Using Iteration:_**

```javascript
class Solution {
public:
    ListNode* reverseList(ListNode* head) {
        ListNode *prev=NULL, *curr=head, *next=NULL;
        while(curr){
            next=curr->next;
            curr->next=prev;
            prev=curr;
            curr=next;
        }
        head=prev;
        return head;
    }
};

```
**_All suggestions are welcome. Please upvote if you like it. Thank you._**
Use Route53 + S3 to forward your domain to absolute URLs.
Tags: route53, s3
Published: 2022-08-05 03:59:34


Suppose that you have a domain name that you want to forward to an absolute URL. For example, you have a domain name `dev.codewithyou.com` and you want to forward it to `https://www.codewithyou.com/blog/cloudfront-restrict-user-access-by-signed-urls`. You can do this with Route53 and S3.

## How to do it

### Step 1: Create a bucket and redirect it to an absolute URL

1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/.
2. Under Buckets, create a new bucket with the name `dev.codewithyou.com`. `Name of the bucket MUST is the name of the domain`. If the name is different, you will not see the bucket in the route53 alias record.
3. Choose the bucket that you created in step 2 and click on the Properties tab.
4. Under Static website hosting, choose Edit.
5. Choose Redirect requests for an object.
6. In the Host name box, enter `www.codewithyou.com/blog/cloudfront-restrict-user-access-by-signed-urls`. This is the absolute URL that you want to forward to your domain. You can use any domain name you want. The URL must not include the protocol (`http://` or `https://`).
7. For Protocol, choose none

![Edit static website hosting](https://www.codewithyou.com/static/images/use-route53-s3-to-forward-your-domain-to-absolute-urls/1.png)

10. Choose Save changes.

You can test the redirect by visiting the bucket url in your browser. For example, `http://dev.codewithyou.com.s3-website-ap-southeast-1.amazonaws.com/`. You should see it redirect to the `https://www.codewithyou.com/blog/cloudfront-restrict-user-access-by-signed-urls` URL.

### Step 2: Create a Route53 alias record

Now you need to create a Route53 alias record. You can do this by going to the Route53 console at https://us-east-1.console.aws.amazon.com/route53/v2/home#Dashboard

1. Click on the Create record button.
2. Specify the following values:
   1. Record name `dev`
   2. Record type `A` Choose A – IPv4 address.
   3. Alias. Select `Yes`. Choose the bucket that you created in step 1.

![Create alias record](https://www.codewithyou.com/static/images/use-route53-s3-to-forward-your-domain-to-absolute-urls/2.png)

Click on the Create records button and wait for the record to be created.

After the record is created, you can test the redirect by visiting the alias record url in your browser. For example, `http://dev.codewithyou.com/`. You should see it redirect to the `https://www.codewithyou.com/blog/cloudfront-restrict-user-access-by-signed-urls` URL.

## Conclusion

This is a simple example of how to use Route53 and S3 to forward your domain to absolute URLs.
You can also do many other things with Route53 and S3.

* Redirect requests for your bucket's website endpoint to another bucket or domain
* Configure redirection rules to use advanced conditional redirects
* Redirect requests for an object

I will continue to add more examples in the future. Thanks for reading!
Introduction of Node.js Modules
Published: 2022-08-05 03:32:15

In this article, we will see the introduction to Node.js Modules. Node.js modules provide a way to re-use code in your Node.js application. Node.js modules to be the same as JavaScript libraries. Node.js provide set of built-in modules which you can use without any further installation. like assert, crypto, fs, http, https, path, url, etc.

Please check more details or modules on Built-in Module in Node js.

> Include Module in Node.js

for include module use the require() function with the name of the module.

```

var http = require('http');

```

---
 
> **_[Read Also: PHP Access Modifiers Example](https://techsolutionstuff.com/post/php-access-modifiers-example)_**

--- 

Now, your application has access to the HTTP module, and is able to create a server.

```

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end('Websolutionstuff !!');
}).listen(3000);

```
 
> Create Custom Modules

You can create your custom modules and you can easily include in your applications.

In below example creates a module that returns a date and time object.

```
exports.custom_DateTime = function () {
  return Date();
};
```

Use the exports keyword to make properties and methods available outside the module file.

Save the code above in a file called "custom_module.js".

---
 
> **_[Read Also: How To Get Current Date And Time In Node.js](https://techsolutionstuff.com/post/how-to-get-current-date-and-time-in-node-js)_**

---

> Include Custom Modules

Now, you can include and use the module in any of your Node.js files.

```

var http = require('http');
var dt = require('./custom_module');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write("Date and Time : " + dt.custom_DateTime());
  res.end();
}).listen(3000);

```
Notice that the module is located in the same folder as the Node.js file. or add path of module file.

Save above code in "custom_module_demo.js" file. and run below command in your terminal.

```
node custom_module_demo.js
```

Output :

```
Date and Time : Wed Sep 08 2021 20:05:04
```
Logging Like You're a Lumberjack
Tags: javascript, beginners, flatiron, programming
Published: 2022-08-05 03:04:00





I am currently a student at Flatiron School. I am studying Software Engineering. This is my first experience with actual coding aside from some BASIC-language programs in the heady days of Atari 800’s and Commodore 64’s. Coding in JavaScript has been quite the shock to a mind which hasn’t had to think like this in a LOT of years! While it has been very challenging, and quite frustrating at times, there has been one thing that has been to me like a lifesaver thrown to a drowning man - the console.log().

In our prework phase of our bootcamp, console.logging is a part of the curriculum. It’s one of the first things they teach you. They mention that it’s not really part of the actual program, but that it’s more of a programming tool that you’ll use a lot down the road. It really doesn’t seem like that big of a deal.  It was not until we started writing functions and manipulating the DOM that I began to appreciate just how much console.logging can do for a programmer. There have been several times when console.logging was the difference between success and failure.

Console.logging is a good way to check your work along the way. Brooke, our primary instructor, harped on us early about console.logging. I didn’t really take it to heart initially. In various one-on-one sessions, instructors would constantly be telling me “Console log it. You just changed something”. If you just picked an HTML element from the DOM, console.log() it and make sure you picked the right one. You just assigned a variable? Console.log() it and make sure that you assigned it correctly. You just did a fetch request? What does the return look like in a console.log()? Knowing that you’ve done things right is really important in every phase of putting together a program.

Console.logging is also great for letting you know what you haven’t done right. No return data from your fetch? Better recheck that resource or check where you actually sent that return. You console.logged in a function and nothing happened? Did you send the right argument? Did you actually invoke the function? And don’t even get me started about console.logging variables. I’ve been coding for real for 3 weeks and I could probably write a book about all the different ways you can jack up assigning or operating with variables!

If it sounds like I love console.log() then I have really understated this post! I try to LIVE it. Every time I write out a bunch of stuff, it inevitably doesn’t work. Then, I have to go back in and try to figure out what’s going on and there’s a LOT to root through. If I had just console.logged as I went, I would at least know what DOES work and if you know that all of your fetch data, DOM elements and variables are right, then you’ve just narrowed things down a lot. Maybe I am a little TOO into console.logging. I console.log() nearly every time I fetch, assign variables, operate on variables, or pick elements from the DOM. It is not the end-all be-all solution, but it certainly has helped me, and made troubleshooting more manageable.
Javascript Tagalog - Arrow Function
Tags: javascript, tagalog, filipino, arrowfunction
Published: 2022-08-05 03:02:35

**Ano ngaba ang Arrow Function sa Javascript?**

Yung arrow function is parang minified version lang kung pano tayo mag define ng function. tignan monalang tong mga pics matamad ako eh.

**Standard Arrow Function**

![Standard Arrow Function](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2g1pg5z9pbe22z8decq6.PNG)

eto yung standard structure ng arrow function, atleast in my interpretation. Parameters naka wrap sila sa parenthesis with the trademark "=>" of the arrow function and the wrap sa {} yung code block.

pwede mo modify yung arrow function in some cases para mas masimplify

---


**1 Expression only**

![ Expression only javascript tagalog ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mivfl72b1fmo5hfu2jld.PNG)

Pwede monang alisin yung curly braces and return statement if 1 expression lang gagamitin mo para mag return ng value

if may kailangan munang may i execute na ibang code before returning maglagay ka dapat ng {} paramaging accessible yung ';' syntax. Don't forget the 'return' also

---

**1 Parameter only**
![ Parameters only Tagalog ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f3js5xk1hdvi35rwezu.PNG)

Pwede monang alisin yung parenthesis para sa parameters if 1 lang yung parameter mo

---

**Callback Function**

Very useful sila sa mga Callback function for example.

![ Callback function tagalog javascript ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdardsvb491kc59pm5xz.PNG)


---

**"This" Keyword in arrow function**


![arrow function is this keyword javascript tagalog ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glpj8hi7dquaimjzind9.PNG)

hindi nako pupunta sa details and go in-depth pwede ka pumunta sa mdn docs for that. Pero for best practices wag gagamitin ang ARROW FUNCTION sa pag define ng method kasi **nag bebehave differently ang 'This' keyword sa arrow function** in this case nag popoint ang this keyword ng getAge sa window/Global object actually.

---

**More tagalog Javascript Learning Resources:**
https://javascript-methods-in-tagalog.vercel.app/
Developer Life: If words could tell!
Tags: developerlife, developer, linux
Published: 2022-08-05 02:41:00

More than a decade back, I looked up for the best text editor on the web and other than the contemporary heroes, it was emacs or vim which stood out to be the classical choice for many developers. It was hard to choose one since both had a strong community advocating one over the other. I decided to go with vim just for the sake of choosing one and trying it out.
I had never heard of modal editing before. And I couldn't believe that I had not thought of it. How could I miss something so obviously important for editing text? What was I thinking all these years repeating my keystrokes to navigate around text? Until then, I only knew the keyboard shortcuts for moving to the end of a line or word with a control key and a character or similar so-called shortcuts. Yet, navigating is just one minuscule capability of vim. 
About six months ago (which is after two decades of computing), I discovered the tiling window manager Xmonad. When used in combination with Arch Linux (and without a heavy desktop environment like Gnome), it feels incredibly powerful and yet simple to manage my workflow needs. The ability to move windows around on one workspace, across workspaces and across multiple displays coupled with the customization to control the look and feel (with keystrokes) is astonishing. And yet navigating around windows is just one of the things that Xmonad allows you to do. I do not know Haskell and this is why I was not sure whether I would stick with Xmonad. But over the last six months, I have been able to modify the config for my needs without learning Haskell, so no complaints!
Xmonad makes me rethink about my window management habits just like how vim made me do it for my text editing. I feel rejuvenated to use my machine.

I would love to hear if you have had such moments with any tools/games or anything tech.

If you liked this post, you may want to read: [Optimizing the Desktop Environment](https://dev.to/rounakcodes/optimizing-the-desktop-environment-top-menu-bar-pg6)
Laravel: Log Sql Query With It's Bindings
Tags: laravel, mysql, builder, macro
Published: 2022-08-05 02:27:15

Most often laravel dev prefer to log the sql query by using below snippet. 

```
DB::listen(function ($query) {
    info('Query', [
    "Query" => $query->sql,
    "Bindings" => $query->bindings,
    "Time" => $query->time,
  ]);
});
```
But the drawback of this is it split out the query, sql bindings and it's time. 

we can do it in a better way to combine the query and it's bindings by using `laravel` Macroable Trait.

Add the Below snippet in `AppServiceProvider` and you are good to go. 

```
Builder::macro('toSqlWithBindings', function () {
  $bindings = array_map(fn($value) => 
                is_numeric($value) ? $value : "'{$value}'",
                $this->getBindings()
            );
            return Str::replaceArray(
             '?', $bindings, $this->toSql()
           );
        });
```

Most of the laravel illuminate classes are by default uses Macroable Trait. By Using that we can add our custom function to that illuminate classes. These functions are available as class function. so we can here chain the custom function to query builder. 

```
$query = User::where('name', 'like' , '%admin%');

$query->toSqlWithBindings();
```
**_Output_**

```
select * from `users` where `name` like '%admin%' and `users`.`deleted_at` is null`
```

**Keep Learning**!!
How to Set Up Carbon Programming Language Manually on Ubuntu 22.04
Tags: ubuntu, linux, carbon, cpp
Published: 2022-08-05 02:20:00

Here’s how I managed to manually install Google’s programming language as a C++ successor in Ubuntu 22.04 GNU/Linux.

`sudo apt install -y apt-transport-https curl git gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update -y && sudo apt install -y bazel clang lldb lld openjdk-8-jdk llvm build-essential libc++-dev
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
export CC=$(which clang)' >> ~/.profile
git clone https://github.com/carbon-language/carbon-lang
cd carbon-lang
bazel run //explorer -- ./explorer/testdata/print/format_only.carbon`

The folder(carbon-lang/explorer/testdata) has carbon sample programs.

Did this article helped you? Share it, comment or give a like if it did! 😄
Javascript Tagalog - "Const" Variable Declaration
Tags: javascript, const, tagalog, filipino
Published: 2022-08-05 02:03:00

**Ano ngaba ang Const Variable Declaration?**
Yung "Const Variable" ay isang type ng block-scoped variable declaration sa javascript na hindi pwedeng ma re-assign ang value

![Const Variable Declaration Tagalog Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7050816xcfrd12lvcdm0.PNG)

Pero sa mga array and objects pwede mo sila i update o alisin.

![Const Variable Declaration Tagalog Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2a947k00v985xqgh48hx.PNG)

---

**Scope**
Ang isang "Const Variable" ay **block-scoped** meaning na accessible lang siya inside a block {} and lower blocks, and yeah if na define mo siya sa global scope then pretty much ma access mo siya kahit saan.


![Const Variable Declaration Tagalog Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4ixin4cka0nivct2o3y.PNG)


kung tatry mo i access ang Const variable sa outside block na kung saan siya na defined. Di mo siya makukuha... parang siya... :(


![Const Variable Declaration Tagalog Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkklydgfgsoa8uchshl2.PNG)

---
**More tagalog Javascript Learning Resources:**
https://javascript-methods-in-tagalog.vercel.app/