teleren/devto huggingface dataset:
Netlify Functions in Javascript with Type-Checking
Tags: jsdoc, netlify, typescript
Published: 2023-07-25 16:24:00

---
title: Netlify Functions in Javascript with Type-Checking
published: true
date: 2023-03-11 00:00:00 UTC
tags: jsdoc,netlify,typescript
canonical_url: https://goulet.dev/posts/netlify-functions-js-typing/
---

![JS Function with strong-typing](https://goulet.dev/posts/netlify-functions-js-typing/function-in-js-with-typing.png)

> Shout out to [Eduardo](https://eduardoboucas.com/) for pointing out that netlify already publishes an npm package with types (I don't need to write my own `.d.ts` file) 💪

## Short Version

```js
/** @type {import("@netlify/functions").Handler} */
export const handler = async (event, context) => {
  // all these properties are typed
  const { httpMethod, body, headers } = event;
  // response is typed
  return { statusCode: 200 }
}
```

## Long Version

I really like Netlify Functions. ❤️

I really like ~~TypeScript~~ modern Javascript with type-checking. 👍

The appeal of [Netlify Functions](https://docs.netlify.com/functions/overview/) is how easy it is to setup: make a file, get a new api endpoint.

Writing code in `.ts` files makes something that was easy become not quite as easy.

Not quite as easy to get started (step 1: add a tsconfig, step 2: figure out what goes into tsconfig).

Not quite as easy to debug ("Why did the debugger just jump down there, are my source maps messed up?").

It's not too bad, but any config/build ceremony that slows down development should be scrutinized.

I find writing `.js` files (actually `.mjs` files, it's 2023, let's embrace ESM) with a combination of `.d.ts` declaration files and jsdoc comments to be the sweet spot of getting type-checking without any Typescript config or build steps. 🚀

Here is how I setup my Netlify Functions projects.

## Step 1: Install `@netlify/functions` npm package

Netlify publishes an NPM package with types for their Functions, add that to your package.json.

```
npm i -D @netlify/functions
```

## Step 2: JSDoc `@type` the handler

Now in your Function's JS file you can use a jsdoc comment to apply typing.

```js
/** @type {import("@netlify/functions").Handler} */
export const handler = async (event, context) => {
  // all these properties are typed
  const { httpMethod, body, headers } = event;
  // response is typed
  return { statusCode: 200 }
}
```

That's it! 🎉
🤖📈 How TweetHunter Used NLP to Build a Successful Startup 🚀
Tags: ai, chatgpt, generativeai, twitter
Published: 2023-03-10 23:15:13

---
title: 🤖📈 How TweetHunter Used NLP to Build a Successful Startup 🚀
published: true
description: Tweet Hunter use of AI as a premium feature without chat GPT which wasn't precise enough
tags: ai, chatgpt, generativeai, twitter
# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ok32o91db989uwbx2svz.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-10 23:06 +0000
---

Are you looking to reduce costs and increase customization on AI models? Well, imagine being able to do that for anything, even coffee ☕️. That's the power of LLMs, which offer customization at six times the cost of their foundational models on platforms like OpenAI.

TweetHunter was able to optimize costs as much as possible by combining Generative AI and Customization to dynamically train models each time data or context changed. This resulted in a powerful model with three capabilities: thread generation, hook generation, and tweet writing.

But how did they do it? It all starts with real data from your users. TweetHunter had access to good data for every niche, and their models were created to take that into consideration. The key is to use NLP and Generative AI, with core libraries like Python NLTK | nltk.TweetTokenizer() and TextBlob.

One of the core libraries used by TweetHunter was Flair. Flair has robust feature engineering capabilities that help it learn effective text representations. It can be fine-tuned to target specific tasks such as named entity recognition, and it has strong support for multi-lingual NLP tasks.

But Flair is just one piece of the puzzle. With Flair, you can classify data, but classification is another beast. To truly build a successful AI-powered tool like TweetHunterIO, you need to go beyond classification and use sentient analysis.


Are you ready to learn more about TweetHunter's architecture? Stay tuned for the next sequence with a working POC! Thanks to makers for the inspiring builders on his 8-figure EXIT.

![Example Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vo5y878gagdtbszoiogn.png)


🤖📈 Don't let your social media strategy get deprecated. Start leveraging the power of NLP and Generative AI today!

Follow me on dev.to or {% twitter 1633968755020636160 %}
A humble call for newbies in #wecoded
Tags: wecoded, beginners
Published: 2023-03-10 23:04:26

In honor of #wecoded, we wanted to highlight some resources we found especially helpful so far from the folks under our tag. We appreciate all of you engaging in narratives of what it was like when you first began coding and how we can continue to push forward through barriers to diversity, equity, and inclusion in tech. 

We hope you all feel welcome to share your perspective regardless of your experience in coding, I know I am definitely a newbie myself as my experience tends more towards front-end web dev, graphic design, etc. It can be intimidating sharing knowledge/experience when you don't feel like an expert or even an intermediate student quite yet, I feel it. 

However, we wanted to extend a hand to say we super want to hear from our newbies this year (me especially because I am one of you!)!

Here are some of our favorite articles so far, to inspire your writing if you choose to share something with us.

1. {% embed https://dev.to/abbeyperini/8-ways-to-support-women-developers-55lf %}

2. {% embed https://dev.to/lolocoding/we-belong-in-web3-3143 %}

3. {% embed https://dev.to/geesilu/tech-equality-pledge-educating-mentoring-and-advocating-for-change-53k6 %}

Find more information about WeCoded [here](https://dev.to/wecoded) and share your own story!

_We hope that you all are having a great week so far!_ 

**And as always, happy coding!** 💜
Day 711 : Feel It
Tags: hiphop, code, coding, lifelongdev
Published: 2023-03-10 22:56:07

_liner notes_:
- Professional : Pretty chill day. No meetings. Did some digital housekeeping. Submitted some forms, answered some emails, helped out with a question in the Community channel Spent the rest of the time I worked on my proof of concept application for work. Made some really good progress.

- Personal : So I set up a Money Market Account and a Roth IRA. I've got to submit a form to transfer money to my Roth IRA. I wrote up a rough financial plan for this year. I know really nothing about money. I just know I'll be reaching an amount that I'm comfortable with in my savings account and want to figure out what's best to do with the money on top of that. Also went through some tracks for the radio show and got a working example for the roadblock I ran into a couple of days ago with my side project.

![A green field in Slovakia with the High Tatras Mountains in the background with a setting sun that is causing a yellow to red to blue halo effect on the center of the photo.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ua153qrmp6l17c0hootj.jpg)

Heard that a bank where a bunch of tech startups in California went under today. That sucks. I feel for all the people that will be affected by this. From what I'm seeing, a bunch of people had more than what is insured for by the government in their accounts. I think the tech industry is really going to fee it. This is why I'm really trying to be smart with my money. Got a couple more financial things to handle tonight. Then work on prepping for the radio show and then work on my side project. Maybe watch some anime to end the night. We'll see.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube _Rl0tmtK2GM %}
What We Learned about A/B Testing from Leemay Nassery: CodeNewbie Podcast
Tags: podcast, codenewbie, beginners, programming
Published: 2023-03-10 22:30:14

[Leemay Nassery](https://twitter.com/LeemayNassery) came onto our podcast this week and talked to us about her prior experiences at different companies, how to progress in your career, and her tips on A/B testing.

We compiled some basics on A/B testing that we learned, in case you haven't had a chance to listen yet! Find more information about A/B testing in Leemay's book ["Practical A/B Testing"](https://pragprog.com/titles/abtest/practical-a-b-testing/).  

1. A/B testing helps us to compare two different versions of a product to see which performs more efficiently in achieving a desired outcome. 

2. This process helps to eliminate risks when making a change in a product and can help you better understand how your decision may impact your users.

3. It takes time, energy, and money to do A/B testing, so weigh your ability to use this tool based off of your circumstances of the job you are in. 

4. Make sure your test is valid and make sure you are not having false positives and negatives.

5. Start simple when beginning A/B testing on your product!

If you listened— what did you learn? Do you have any tips on A/B testing?

Drop your thoughts below and don't forget to give it a listen [here](https://www.codenewbie.org/podcast/practical-a-b-testing) or wherever you listen to your podcasts! 💜
Hackathon - Hack Together: Microsoft Graph and .NET 🦒 - Day 06
Tags: azure, webassembly, csharp, dotnet
Published: 2023-03-10 22:13:13

Today I worked on the UI. Only on the UI.
I was hoping there would be something on FluentUI for drawing a layout, but after a bit of searching in the documentation, I didn't actually find anything.

This is the reason why I created a three columns layout manually.

First of all I added the following code in the app.css file:

```css
.row {
    display: flex;
}

.column {
    flex: 33.33%;
    height: 400px;
    padding: 8px;
    margin: 12px;
    text-align: center;
}
```
Using flex for this kind of layout is very easy and I think it's the fastest way to create a simple columns layout like this.

Then I changed the index.razor and I added a div around the three Fluent Card with the class "row" I have created one step before.

```html
        <div class="row">

            <M365.Today.Components.CalendarCard />

            <M365.Today.Components.MailCard />

            <M365.Today.Components.ToDoCard />

        </div>
```
Then I changed each Fluent Card by adding the class "column" to the element.
This is the example of the TodoCard:

```html
    <FluentCard Class="column">
        <div class="contents">
            <FluentIcon Name="@FluentIcons.Check" Size="@IconSize.Size32" Variant="@IconVariant.Regular" Color="@Color.Accent" />
            <div data-is-scrollable="true">
                <FluentDataGrid RowsData="@todos">
                    <PropertyColumn Property="@(p => p.Title)" Title="Title" />
                    <PropertyColumn Property="@(p => Convert.ToDateTime(p.DueDateTime.DateTime))" Format="MM-dd-yyyy" Title="Due Date" />
                </FluentDataGrid>
            </div>
        </div>
    </FluentCard>
```

I wanted to add some colours and a good background to the page. I decided to use the Bing image of the day.
After a quick search, I founded the following repository on GitHub.com.

{% embed https://github.com/TimothyYe/bing-wallpaper %}

I changed again the app.css file by adding a customization for the body element:

```css
body {
    background-image: url(https://bing.biturl.top/?resolution=3840&format=image&index=0&mkt=zh-CN);
    height: 100%;
    width: 100%;
    background-repeat: no-repeat;
    background-size: cover;
}
```
As I read in the documentation, it's possible to use the API directly in the CSS to add the image as background.

This is the result:

![the result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ishuzyf76whbivjmnh2o.png)

Not the best page in the world, but start to be a good page in terms of layout cleaning and good UI.

---

Are you interested in learning GitHub but don't know where to start? Try my course on LinkedIn Learning: [Learning GitHub](https://bit.ly/learninggithub).

![LinkedIn Learning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdc2bpiftpadibi4h51c.gif)

---

Thanks for reading this post, I hope you found it interesting!

Feel free to follow me to get notified when new articles are out 🙂

{% embed https://dev.to/kasuken %}
AWS Cloud Quest: Data Ingestion Methods Study Note
Tags: aws
Published: 2023-03-10 22:08:23

This is the DIY challenge of the Data Ingestion Methods in AWS Cloud Quest.

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

### DIY Steps:
1. Add destination for `ClickStreamDataApp` SQL applications(legacy)
    - AWS Lambda function: `AnalyticsDestinationFunction`
    - Existing IAM role: `LabKinesisAnalyticsRole`
    - Existing in-application stream: `DESTINATION_SQL_STREAM`
    - Output format: `CSV`
Account Registration: Using Allow-List Rather than Blacklist for Email Providers
Tags: steem, blockchain, blog, account
Published: 2023-03-10 21:46:44

I am a bit tired of blacklisting email providers in [Steem Account Registration](https://steemyy.com/reg.php) services, as there are many temp email providers. If you own a domain, you can have unlimited email addresses for yourself (with a catch-all email). [Microsoft](https://helloacm.com/a-glimpse-on-microsoft-research-cambridge/) Outlook, Hotmail and MSN have unique email aliases which cannot be distinguished at all. The gmail ignores dots, and can have different labels with the plus sign. 


![image.png](https://cdn.steemitimages.com/DQmNpetSGo3kitymejwwr5oc5MVaFzrBZ2WgsAT7xJD8bKM/image.png)

There is no good solutions to this, as the emails look totally different. Gmail addresses can be detected as the dots and labels (+) can be easily identified.

However, if you do want to use other email providers to register, please contact me at justyy [at] zoho.com and I'll take a look and approve it case by case.

So, instead of having a blacklist, why not just an allowlist (or whitelist).

Current whitelisted emails:

<blockquote>
gmail.com
googlemail.com
yahoo.com
yahoo.com.hk
yahoo.co.uk
justyy.com
qq.com
163.com
sina.com
icloud.com
mail.ru
zoho.com
</blockquote>

Register a free STEEM account at [here](https://steemyy.com/reg.php)

<hr/>

### [Steem](https://steemyy.com) to the Moon!
You can swap the STEEM/SBD to USDT (TRC-20) via [Steem2USDT](https://steemyy.com/steem2usdt.php)
Help Build a Revolutionary Social Media Platform for the Agriculture Industry
Tags: javascript, programming, opensource, webdev
Published: 2023-03-10 20:48:58

Are you a skilled web developer with a passion for agriculture and technology? Do you want to make a difference in the agriculture industry around the world? If so, I need your help!

I'm looking for volunteer programmers to help me build a revolutionary social media platform using modern front-end and back-end technologies that will bring farmers together and revolutionize the agriculture industry. The platform will be built using JavaScript & React js for the front-end, and Node.js, Express.js, and MongoDB for the back-end.

What I'm looking for:

Experience with modern web development technologies, including JavaScript for the front-end, and Node.js, Express.js, and MongoDB for the back-end.

Familiarity with social media platforms and their features.

A passion for agriculture and an interest in making a difference in the agriculture community.

A willingness to work collaboratively with other volunteers to build the platform.

What's in it for you?

The opportunity to use your programming skills for a good cause and make a positive impact on the agriculture industry.

The chance to work with other talented programmers and learn new skills.

The satisfaction of seeing your work come to life and being used by farmers from many countries in Europe and Africa .

A chance to add a valuable project to your portfolio and gain recognition for your work.

A chance of being hired once the platform is launched & settled well with the help of cooperatives in Italy and in Tunisia ( north Africa ) , as we will need a solid team to keep optimizing the platform later on .

A chance to be paid for milestone projects after the launching of the platform in many countries .



if you're interested reach out to me via email : ghassenmansouri@mail.com
FREE AWS Cloud Project Bootcamp Week 3 Part 2
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-03-10 20:25:09

[69/100] #100DaysOfCloud Today, I completed a part of the Week 3 of the FREE AWS Cloud Project Bootcamp by Andrew Brown.

Here's what I completed:
- Implement API calls to Amazon Cognito for custom signup Page.
- Implement API calls to Amazon Cognito for confirmation page.
- Implement API calls to Amazon Cognito for recovery page.
- Implement API calls to Amazon Cognito for forgot password page.

By doing this, I was able to create a custom sign up page, through which I was ale to implement API calls t Amazon Cognito and create an User. When an user us created, it sends a confirmation code to our email which is used to confirm our newly created account. When you log in using that credentials, it logs us to our newly created user. We can also reset the password in case we forget out password using the Forgot password option.

[GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/069/Readme.md)

You can watch the Bootcamp through this YouTube playlist : [FREE AWS Cloud Project Bootcamp playlist](https://youtube.com/playlist?list=PLBfufR7vyJJ7k25byhRXJldB5AiwgNnWv)
My Month Of Developing Web Projects: A Reflection on Learning, Motivation, and Achievements
Tags: webdev, beginners, productivity, opensource
Published: 2023-03-10 20:20:58


A few years ago, as my interest in programming was just beginning to take off, a friend of mine issued a cool challenge: "Who can commit to dedicating an entire month to GitHub, with perhaps one or two days off?" I accepted the challenge, but to be honest, we both fell short of the goal.

Fast forward to a month ago, when I found both the time and motivation to create a few web projects for myself, and I recalled this challenge. My primary objective was to construct a personal website, and then, if I was fortunate, move on to something else. And thus began this remarkable month.

I'm not entirely certain I can fully articulate the emotions I experienced when the site finally went live. Every moment I spent programming this project was enjoyable. Why, you may ask? Perhaps it's because it wasn't a trivial undertaking such as a calculator. It was something that required effort and resulted in something unique. I built it from scratch. This was the lesson I learned: "Create what interests you." Seek out a project that excites you, and you will invest your heart and soul into it, thereby acquiring new skills with ease.

And so, I worked on my projects for five days a week, and triumphed over my self-imposed challenge.

P.S. Focus on being better than you were yesterday, rather than comparing yourself to others. Strive to achieve personal goals and exceed your own expectations.
ChatGPT: basic example of an Nginx configuration file using an auto-signed SSL certificate
Tags: ssl, certificate
Published: 2023-03-10 20:09:55

This article was created by ChatGPT

Here is a basic example of an Nginx configuration file using an auto-signed SSL certificate:

```bash
Copy code
server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
    ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

    location / {
        # your application code here
    }
}
```
Here are the steps to generate the auto-signed SSL certificate and key files:

Generate the SSL certificate and key files using OpenSSL:

```shell
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout /etc/ssl/private/nginx-selfsigned.key \
  -out /etc/ssl/certs/nginx-selfsigned.crt
```
This command will prompt you for some information to include in the certificate, such as the Common Name (CN) which should be set to your domain name (e.g. example.com).

Verify that the certificate and key files were generated:

```shell
$ ls -l /etc/ssl/private/nginx-selfsigned.key /etc/ssl/certs/nginx-selfsigned.crt
```
You should see output similar to:

```bash
-rw-r--r-- 1 root root 1091 Feb 24 15:44 /etc/ssl/certs/nginx-selfsigned.crt
-rw-r--r-- 1 root root 1675 Feb 24 15:44 /etc/ssl/private/nginx-selfsigned.key
```
Copy the configuration file above into your Nginx server block, replacing the example.com server name with your own domain name.

Reload the Nginx configuration:

```bash
$ sudo systemctl reload nginx
```
That's it! Your Nginx server should now be configured to use the auto-signed SSL certificate.
Constantly Changing Technology
Tags: webdev, javascript, computerscience
Published: 2023-03-10 19:33:06

Entering into this area of technology can be equal parts exciting and terrifying.  The exciting part is of course we can take tools, especially tools that are pretty commonly and freely available to anyone, and we feel as though we can create anything that we have in our imagination.  However, especially for people that are just starting in the industry, engaging in this field can be a little scary because we have to invest in a lot of time and resources to learn this area, but there always feels like there is a threat that all of that time and resources may just go out the window because the next day that technology that you were learning is being replaced by the new hot thing.  This is a bit terrifying.

So, what do we do with this problem?  For me personally, I've been pouring myself into learning Javascript and even more specifically working on React.  Even though React is very important and popular in the moment, I remember when Php was in the same spot.  There is always that fear that there will soon be a new Javascript library or even something outside of Javascript completely that will come and make all of this hard work completely useless.

One great thing is that as the technology changes, the core principles and concepts really don't change that much, and I have been able to see this in other fields.  For example, a long time ago I worked for quite a while as a sound engineer.  During that time working as a sound engineer, there were major shifts in technology and workflow for most in that industry.  Most of the engineers of that time were used to working with analog sound systems before that time but now there was a huge push to make everything digital and with a computer interface.  While many sound engineers are obviously very technically minded, the idea of changing old workflows many times would introduce a lot of new stress.  All of this being said, there was still good news.  Even though equipment and workflows were changing, the old principles of dealing with sound waves were still the same.  The methods of EQing mics and speakers were really still the same.  There really was just an evolution on the old concepts.

I say this because in this field were we joke that every week there is a new Javascript library or framework, Javascript is still Javascript.  Computer Science is still Computer Science.  The principles within the industry will of course evolve and hopefully continue to grow, but in the end it will not change very quickly.  Maybe we need to learn how to apply them differently, but that's ok, because it is an opportunity to still be able to apply what we already know and maybe be able to grow into something new still.