teleren/devto huggingface dataset:
Facade pattern in TypeScript
Tags: typescript, architecture, javascript, webdev
Published: 2023-01-08 18:57:46

## Introduction

The facade pattern is a structural pattern which allows you to communicate your application with any complex software (like a library or framework) in a simpler way. It is used to create a simplified interface to a complex system.

![Diagram](https://www.jmalvarez.dev/images/facade-pattern-typescript/diagram.webp)

## Applicability

- you don't want your application to be tightly coupled to a 3rd party library or framework
- you want to simplify the interaction of your application with a complex system

## Implementation

You can find the full example source code [here](https://github.com/josemiguel-alvarez/design-patterns-typescript/blob/main/structural-paterns/facade/facade.ts). As an example of the implementation I'm going to create an application that uploads files to a cloud storage service.

Let's imagine that the 3rd-party code is something like the following:

```ts
class CloudProviderService {
  public isLoggedIn(): boolean {
    // Checks if the user is logged in
  }

  public logIn(): void {
    // Logs the user in
  }

  public convertFile(file: string): string {
    // Converts the file to a format that the cloud provider accepts
  }

  public uploadFile(file: string): void {
    // Uploads the file to the cloud provider
  }

  public getFileLink(file: string): string {
    // Returns the link to the uploaded file
  }
}
```

As we don't want to couple our application with this 3rd-party code we are going to create a facade that will hide the complexity of it. This facade will be the only class that our application will interact with.

```ts
class CloudProviderFacade {
  private service: CloudProviderService;

  constructor() {
    this.service = new CloudProviderService();
  }
}
```

Now we have to implement the functions that our application will use to interact with the 3rd-party code. For the example I'm going to only implement one function:

```ts
class CloudProviderFacade {
  private service: CloudProviderService;

  constructor() {
    this.service = new CloudProviderService();
  }

  public uploadFile(file: string): string {
    if (!this.service.isLoggedIn()) {
      this.service.logIn();
    }

    const convertedFile = this.service.convertFile(file);
    this.service.uploadFile(convertedFile);

    return this.service.getFileLink(convertedFile);
  }
}
```

And that's it! Like this we have implemented the Facade pattern. It's very simple and very useful at the same time. A simple example of how the client would use this code:

```ts
const facade = new CloudProviderFacade();
const fileLink = facade.uploadFile("file.txt");
console.log("File link:", fileLink);

/*  
  Output:

  Logging in...
  Converting file... file.txt
  Uploading file... file.txt.converted
  File link: https://example.com/file.txt.converted
*/
```

## Resources

- [Example source code](https://github.com/josemiguel-alvarez/design-patterns-typescript/blob/main/structural-paterns/facade/facade.ts)
- [Composite - refactoring.guru](https://refactoring.guru/design-patterns/facade)
My Learning Strategy
Tags: learn, programming
Published: 2023-01-09 01:35:56

Learning actively if i am doing a course in programming I will actively code along without just watching and not putting my knowledge into action.

Don't try to do everything in one day.

Whatever you learn if you think you have mastered it try teaching it to another person to test if yourself (write a blog post,Journal entry etc...).

Write all your questions down in one place and then answer all of them later.

Some tips 🙌🏽: 
Sleep for 7-8 hours a night 
Sleep at 10:00pm 
wake up at 05:30 AM.
Doubly Linked List Series: Creating shift() and unshift() methods with JavaScript
Published: 2023-01-09 13:46:16

Building off of last week's blog on Doubly Linked List classes, push(), and pop() methods - [linked here](https://dev.to/tartope/doubly-linked-list-series-node-and-doubly-linked-list-classes-with-push-and-pop-methods-using-javascript-37e) - today I will be discussing shift() and unshift() methods.  Starting with shift(), this method does not take a parameter and removes the first node from the beginning of the list.  Here is an illustration of a shift() method:

![Drawing of shift method](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0ss0fne1xpvyc6h6utf.png)

Edge case: you can account for an empty list, or has only one node.  If neither of those cases applies, then follow the steps above.

Here is an example of code for a shift() method:

![Screen shot of shift method code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s41ul2sd166fzmbx7ofz.png)

The method unshift() adds a node to the beginning of the list.  Here is an illustration of this method:


![Drawing of unshift method](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dnahdlxfnq6mad4vhecw.png)

Edge case: you can account for an empty list.  If the list is not empty, then follow the steps mentioned above.

Here is an example of code for an unshift() method:

![Screen shot of unshift method code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2jg7txaghbigr84oeoh.png)

The time complexity for shift() and unshift() methods for a Doubly Linked List is O(1) constant time.  The length of the list does not impact the number of steps to remove from the beginning or add to the beginning of the list.

In the next part of this series, I will share what I have learned about creating get() and set() methods for a Doubly Linked List.
Getting started with Nix Package Manager
Tags: nix, linux, wsl2
Published: 2023-01-10 15:30:00

Nix is a standalone package manager from the NixOS family that can be installed on other Linux/Unix OS.

`https://nixos.org/download.html`

## Installation:

To install nix on WSL:

```bash
sh <(curl -L https://nixos.org/nix/install) --no-daemon
```

Then add `source $HOME/.nix-profile/etc/profile.d/nix.sh` to your `.bashrc` or `.zshrc`.

## Usage:

- Searching a package: `nix-env -qa firefox`
- installing a package: `nix-env -i firefox` or `nix-env -iA nixpkgs.firefox` (works on non-nix OS only)
- List installed packages: `nix-env -q`
- Uninstall a package: `nix-env -e firefox`
- Upgrade a package: `nix-env -u firefox`
- Upgrade all packages: `nix-env -u`
- Cleanup: `nix-collect-garbage -d`
How To fetch data from an API in a React application
Tags: javascript, beginners, react, api
Published: 2023-01-09 18:26:59

To fetch data from an API in a React application, you can use the fetch() function, which is a built-in JavaScript function for making network requests. Here's an example of how you might use fetch() to retrieve data from an API and store it in a React component:

```Javascript 
import React, { useState, useEffect } from 'react';

function MyComponent() {
  const [data, setData] = useState(null);

  useEffect(() => {
    async function fetchData() {
      const response = await fetch('https://my-api.com/endpoint');
      const data = await response.json();
      setData(data);
    }
    fetchData();
  }, []);

  return (
    <div>
      {data && (
        <div>
          {data.map(item => (
            <div key={item.id}>{item.name}</div>
          ))}
        </div>
      )}
    </div>
  );
}

```


In this example, we're using the useEffect() hook to perform the fetch operation when the component mounts. The useEffect() hook is called with a function that contains the fetch() call, and an empty array as the second argument, which tells React to only call the function when the component mounts.

Once the data is fetched, it is stored in the component's state using the useState() hook, and the component renders the data by mapping over it and rendering each item as a div.
Developers - which tools have you ever paid for or wouldn't mind paying for?
Tags: discuss, startup
Published: 2023-01-09 22:56:29

In their [farewell post](https://www.kite.com/blog/product/kite-is-saying-farewell/), the Kite team says that one of the biggest challenges they had was that they couldn't make their 500K strong community to pay for the product.
I was wondering which tools do developers consider worthy of paying for and why?
5 websites will make you a smarter 🏆 developer👩‍💻
Tags: programming, webdev, javascript, python
Published: 2023-01-10 02:21:00

Here is the list of the best 5 websites to help you with your projects. 

### Novu

- The open-source notification infrastructure for developers.
- Simple components and APIs for managing all communication channels in one place Email, SMS, Direct, and Push

### Reactive Resume

- Reactive Resume is a free and open source resume builder.

###  Open Source Alternative to

- Open source alternatives to some popular tools.

### Axiom 

- Use browser bots to automate website actions and repetitive tasks on any website or web app.

### Magic patterns

- Beautiful pure CSS background patterns that you can actually use in your projects.

Happy working 🙂


🎥 [Websites links:](https://youtu.be/LgkcEWC6uKY)


###Bonus:


#### Top GitHub 👩‍💻 Alternatives Hosts Part One🚀 

🎥 [Websites links:](https://youtu.be/YmtTmDjT1u4)


#### Web developers tools 🛠️ you need to know💡👩‍💻

🎥 [Websites links:](https://youtu.be/2VRXU2H4q0c)



### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
Gorilla Flow - Ingredients, Side Effects, Warning & Complaints?
Tags: webdev, javascript, beginners, programming
Published: 2023-01-10 07:34:32

Gorilla Flow oil is reduced greatly by just choosing an efficient mattress. While mattresses are expensive, suppliers want that try them for around a month or longer, provided it is really protected.TIP! Speak with your doctor hard to think but coffee is said to be of help when attempting to sooth chronic back pain. Recent possess shown hinders the chemical adenosine.
https://www.deccanherald.com/brandspot/pr-spot/gorilla-flow-prostate-supplement-official-website-review-and-customer-feedback-1146688.html
https://soundcloud.com/gorilla-flow-963476885/gorillaflowinfo
https://www.pinterest.com/pin/1011761872514158287/
https://www.instagram.com/gorillaflowprice/
https://www.scoop.it/topic/gorilla-flow-info
https://twitter.com/GorillaFlow2 
https://tautaruna.nra.lv/forums/tema/49291-gorilla-flow-prostate-health-reviews-pros-cons-uses-benefits/
https://www.sportsblog.com/gorillaflowbuys/gorilla-flow-benefits/
Destroy All Goblins is Launched
Tags: gamedev
Published: 2023-01-10 18:22:18

---
title: Destroy All Goblins is Launched
published: true
date: 2023-01-09 18:09:00 UTC
tags: gamedev
canonical_url: http://www.brettchalupa.com/destroy-all-goblins-is-launched
---

After a month of work, my largest game to date, is finished! It’s called _Destroy All Goblins_. I made it with DragonRuby Game Toolkit. It took me 50 hours, and it came in at 2,149 lines of code.

[![Destroy All Goblins screenshot](http://www.brettchalupa.com/uploads/destroy-all-goblins-screenshot-1.png)](https://brettchalupa.itch.io/destroy-all-goblins)

[Play _Destroy All Goblins_!](https://brettchalupa.itch.io/destroy-all-goblins)

[![Available on itch.io](http://www.brettchalupa.com/uploads/itch-badge.png)](https://brettchalupa.itch.io/destroy-all-goblins)

Or watch the trailer:

{% embed https://www.youtube.com/watch?v=wbu3LSfB68s %}

_Destroy All Goblins_ is a small freeware game for personal computers. It’s inspired by _Super Crate Box_, and it uses art assets by [Pixel Frog](https://pixelfrog-assets.itch.io/) from the public domain.

I had such a fun time making it, and I learned a ton. I’m looking forward to reflecting and writing a post-mortem after I have a little space from the project. I’m not quite sure what I’ll work on next, but I’ve got a lot of ideas.

For now though, it’s time to take a little break from such focus and relax a little bit!
Garbage Collection C#
Tags: csharp, garbagecollection
Published: 2023-01-10 11:24:42

# Garbage Collector

## Glossary

### Heap
    Portion of memory where dynamically allocated objects resides.
### Managed Heap
    Whenever we start any process or run our .NET code, it 
    reserves some space in the memory which is contiguous and 
    it's called managed heap.


There were the days when the developers would be required to release the memory which they have allocated for the objects.

It's the developers responsibility to manage the memory, and this brings some issues during development.

- If we create a new object but forget to delete it, it will persist in the memory for a long time even if we didn't want to use it.

- If our variable is referencing an object in the memory, and later that variable started referencing another object in the memory, then the previous object will persist in memory even if no variable in referencing this object. It's called memory leak. Object is not referenced by any variable and also not required but still in memory.

To overcome these scenarios, .NET came up with the garbage collector, which will take care of deleting the objects from the memory.

But, the garbage collector is limited to allocate or release the memory of managed code only, it does not allocate or release the unmanaged memory.

Managed Code is the code which runs under the .NET environment. .NET takes care of its memory management.
But the code which is outside of the .NET environment called the unmanaged code. .NET garbage collector doesn't know how to release the memory of unmanaged code.

Managed code written in the .NET might access unmanaged code.
- for ex:- Connecting with database using SQL, Oracle classes, Network calls made from managed code, accessing files.

Even though we are writing the managed code, but this code is using the unmanaged code. So as a developer it's our responsibility to release the memory once the work of these objects are completed.

### How do we release the memory then?

.NET provides the IDisposable interface for the types (example:- class) which are using the unmanaged code, for ex, network calls, database connection etc.

Those types needs to implement IDisposable interface and provides the implementation of the Dispose() method and write their own logic to release the memory.

And our task as a developer is that once we are done with these objects, we should call the dispose method on these objects.

.NET also provides a Finalize method, in case developer forgets to call the dispose method on this object.

GC releases the memory even if we forget to call the dispose method, if that class also implements the finalize, but the crux here is that finalize in indeterministic and dispose is deterministic.

It means we have control over the dispose method, when to call. But that finalize will be in hand of GC, when it calls.
CVE vulnerabilities on Google Chrome prior to releases around on Dec. 2022
Tags: chrome, chromium, security, vulnerability
Published: 2023-01-10 23:26:52

## Overview

### Google Chrome vulnerabilities

[CVE](https://cve.mitre.org/cve/)-2023-0140 (and more)

[Chrome](https://www.google.co.jp/chrome/browser/) on Windows (and more), whose version is prior to 109.0.5414.74, has risk to make remote attack easy.

109 was released around last month.

\-- Recommended to update.

### Other vulnerabilities

> CVE-2023-0140 (and more)    
> That on Windows (and more)

Other vulns related to Chrome prior to 109.0.5414.74, including Android, ChromeOS, etc.:

CVE-2023-0128, 0129, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 0138, 0139, 0141.

### As to Chromium

Well, some of CVE security severity on [Chromium](https://www.chromium.org/), which Chrome based on: High or Medium.

### As to Microsoft Edge

As Chromium is affected, Microsoft [Edge](https://www.microsoft.com/edge) is possibly also affected.

## Note

This post is based on [our tweets](https://twitter.com/scqrinc/status/1612943292085465088?s=20).

### CVE news

https://twitter.com/CVEnew/status/1612913531338235920?s=20
Best SEO Training Institute in Chennai
Tags: seo, training, tutorial, beginners
Published: 2023-01-11 07:12:25

Intellimindz is a leading [SEO Training Institute in Chennai](https://intellimindz.com/seo-training-in-chennai/
) that provides the finest SEO training for beginners and advanced learners. Build a successful career in SEO with the assistance of Intellimindz professionals who have more than 8+ years of experience in SEO. Call us at 09655877677 to schedule a free DEMO now.
Parse Azure SAS token using regular expression
Tags: azure, azuresecurity
Published: 2023-02-03 21:23:14

---
title: Parse Azure SAS token using regular expression
published: true
description: 
tags: #azure #azuresecurity
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-03 21:02 +0000
---

If you have an Azure SAS token that is not working, it is good idea to parse it and understand what permissions and values it contains.  

This is a JavaScript code that uses Regular Expression to parse he SAS token, and an running example where you can try your own SAS token.

```js
var paramNames = {
  sig: 'cryptographic signature',
  st: 'start time',
  se: 'end time',
  spr: 'protocol',
  srt: 'resource types',
  sv: 'version',
  sp: 'permissions',
  ss: 'services'
};

let valueLookups = {
  sp : {
     r: 'read', d: 'delete', w: 'write', l: 'list', a: 'add',
    c: 'create', u: 'update', p: 'process', f: 'filter'
    },
  srt: {
    s: 'service', c: 'container', o: 'object'
  },
  ss : {
    b: 'blob', f: 'file', q: 'queue', t: 'table'
  }
}

let valueConvertor = (key, inputValue) => 
      valueLookups[key] ? [...inputValue].map(x => valueLookups[key][x] || x)
        : inputValue;

function parseData(sasToken) {
  let regExpressionPattern = /[?&]([a-z]*)=([^\&]*)/g;
  var parameters = [...sasToken.matchAll(regExpressionPattern)];
const finalObject = parameters.reduce((acc, row) => {
  return {...acc, [paramNames[row[1]] || row[1]]: valueConvertor(row[1], row[2])}
}, {});

  
var outputObject = ParseData(inputSasToken);

// The output object will be in the format
{
  "version":"2021-06-08",
  "services":["blob","file","queue","table"],
  "resource types":["service","container","object"],
  "permissions":["read","write","delete","list","add","create","update","process","i","y","t","filter","x"],
  "end time":"2023-02-04T03:03:37Z",
  "start time":"2023-02-03T19:03:37Z",
  "protocol":"https",
  "cryptographic signature":"..jhh"
}

```


{% codepen https://codepen.io/gkarwchan/pen/yLqZXNq %}
How to Choose the Right Frontend Framework for Your Application: A Guide to Popular Choices and Key Factors to Consider
Tags: webdev, javascript, react, programming
Published: 2023-01-11 11:12:50

Choosing a frontend framework for your application can be a daunting task, as there are many options available and each has its own strengths and weaknesses. In this blog post, we will discuss some of the key factors to consider when selecting a frontend framework, as well as provide an overview of some popular choices.


1. Consider the size and **complexity of your application**. If you’re building a small, single-page application, a lightweight framework like Vue.js or React may be a good fit. However, if you’re building a large, complex application with many features, a more robust framework like Angular or Ember may be more appropriate.

2. Think about the **development team’s skillset and experience**. If your team is already familiar with a particular framework, it may make sense to continue using it for the current project. However, if your team is open to learning a new framework, it may be worth considering one that is more suited to the project’s needs.

3. Evaluate the framework’s **performance and scalability**. It’s important to choose a framework that can handle the performance and scalability requirements of your application. This includes factors like the amount of data that needs to be loaded and processed, as well as the number of concurrent users.

4. Check the framework’s **documentation and developer experience**. A good framework should have clear and comprehensive documentation, as well as a developer-friendly API. This can make it easier to build and maintain the application over time.

5. Look at the **framework’s support and community**. A framework with a large and active community is more likely to have a wealth of resources, tutorials, and plugins available, which can make development faster and more efficient. Additionally, if a framework is well-supported, it’s less likely to become obsolete in the near future.

**Popular Frontend Framework:**

- **React**: Is a JavaScript library for building user interfaces. It’s widely used by many companies and developers, and has a large and active community.
- **Angular**: Is a full-featured framework for building web applications. It’s backed by Google and has a large and active community of developers.
- **Vue**: Is a progressive JavaScript framework for building user interfaces. It’s easy to learn and has a small footprint, making it well-suited for small- to medium-sized projects.
- **Ember**: Is a full-featured framework for building web applications. It’s designed for ambitious web applications and has a relatively small but dedicated community.

In summary, choosing a frontend framework for your application depends on various factors such as size and complexity of the application, the development team’s skillset and experience, performance and scalability, community support, and developer experience. Careful consideration of these factors will help you make the best decision for your project.
Installing Apache Web Server
Published: 2023-01-12 02:33:10

Installing Apache Web Server on Linux Mint

to check the update
$ sudo apt-get update

this command to install Apache.
$ sudo apt-get install apache2 apache2-utils

The following commands will cause Apache to start when the server starts-up and start the service for the first time:
$ sudo systemctl enable apache2
$ sudo systemctl start apache2


Verify Apache Service Status on your Linux

$ hostname -i  (give you the ip address)
 
enter the ip address in the web browser

"Ubuntu Logo Apache2 Ubuntu Default Page"
NowPatient.com - Personalised care
Tags: pharmacy, healthcare
Published: 2023-01-12 03:32:01

Now Patient is the UK’s first regulated digital health service that uses predictive analytics and artificial intelligence to deliver proactive healthcare services.

Now Patient helps you manage your prescriptions, GP appointments, test results, health risks, and a lot more, all in one place for free.

[https://nowpatient.com](https://nowpatient.com)
Get Better Look By Wearing Stylish Yellow Leather Jacket
Published: 2023-01-12 05:24:35

Jacketars Store offers women's [Yellow Leather Jacket](https://www.jacketars.com/product/yellow-womens-leather-jacket/). Our top pick for the day is the color yellow. It's not actually bright sun yellow , but it's more mustard. Slim fit can be accomplished without a workout by wearing this color as it will fit perfectly with your body's curves. The lapel collar that has authentic quality YKZ zipper is exactly what we want.

Double necklines, which have two internal and three external pockets, are connected to the top of the chunks. Bolts on the collar serve as a way to style. Put on the the Bellivera Jacket for Women with pants or jeans and you're finished. The straps on to the backline balance out the slim overall. We thank God for the inner viscose lining, which will make you feel comfortable.

The fashion Jacket has the reputation of being trendy in its own right. All white , with black entails, linings , and zippers show off collars that contrast in the most attractive way. In truth, you can make use of the women's Bellivera Yellow Jacket for your formal gathering and also for any semi-formal gathering you're preparing to go with.