Snippset
Filter by Set

Snipps

...see more

Make Axios send cookies in its requests automatically.

You can use the withCredentials property.

axios.get(BASE_URL + '/todos', { withCredentials: true });

Also it is possible to force credentials to every Axios requests

axios.defaults.withCredentials = true

Or using credentials for some of the Axios requests as the following code

const instance = axios.create({
   withCredentials: true,
   baseURL: BASE_URL
})
instance.get('/todos')
...see more

Axios is a popular JavaScript library that simplifies HTTP requests, making it easy for beginners to interact with web services and APIs. With a simple and intuitive syntax, Axios provides a clean way to handle asynchronous tasks in web development. Whether fetching data or sending requests, Axios streamlines the process, enhancing the efficiency of frontend development.

Azure by Patrik
...see more

Source app settings from key vault

Complete reference:

@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret/)

Alternatively:

@Microsoft.KeyVault(VaultName=myvault;SecretName=mysecret)

Source: Use Key Vault references - Azure App Service | Microsoft Learn

...see more

Variables declared with the const maintain constant values. const declarations share some similarities with let declarations.

...see more

Variables are containers for storing data in JavaScript. JavaScript variables can be declared in 4 ways:

  • Automatically
  • var: Declares a variable with function scope. It's less commonly used in modern JavaScript due to its potential for scope-related issues.

  • let: Declares a variable with block scope, limiting it to the block or statement in which it's defined. It allows reassignment.

  • const: Declares a constant variable with block scope. Once assigned, its value cannot be changed.

Choosing between them depends on your needs for variable scope and mutability. const is preferred when you don't intend to change the variable's value, while let is suitable for variables that need to be reassigned. var is generally avoided in modern JavaScript due to its quirks related to scope.

We'll discuss the differences in Scope, Redeclaration, and Hoisting.

...see more

let is now preferred for variable declaration. It's no surprise as it comes as an improvement to var declarations. It also solves the problem with var that we just covered. Let's consider why this is so.

...see more

Before the advent of ES6, var declarations ruled. There are issues associated with variables declared with var, though. That is why new ways needed to declare variables to emerge.

...see more

The var declares a variable with function scope.

Scope of var

  • Global scope normally
  • Start to end of the function inside of the function

Redeclaration

  • Yes, can redeclare it in the same scope

Hoisting

  • Hosted at the top of the global scope
  • It can be used before the declaration
...see more

JavaScript collections refer to data structures in the JavaScript programming language that are used to store and manipulate collections of values or objects. These collections provide various ways to organize and access data efficiently. There are several built-in collection types in JavaScript, and developers can also create custom collections as needed.

In JavaScript, collections like arrays, objects, sets, and maps are built-in language features. They are part of the core JavaScript language and do not require any external extensions or libraries to use. JavaScript provides these data structures as fundamental constructs for working with and organizing data within your programs.

...see more

JavaScript is a versatile and widely-used programming language, known for its ability to add interactivity and dynamic behavior to web pages. Key features include its simplicity, support for both front-end and back-end development, asynchronous capabilities, and a vast ecosystem of libraries and frameworks, making it essential for modern web development.

...see more

Arrays are ordered collections of values, and they are perhaps the most commonly used data structure in JavaScript. Elements in an array can be accessed by their index, and arrays can hold values of different data types.

let myArray = [1, 2, 3, 4, 5];
console.log(myArray[0]); // Accessing the first element

 

...see more

Objects in JavaScript are collections of key-value pairs. They are versatile and can be used to represent a wide range of data structures. Objects are often used for creating dictionaries, maps, and records.

let person = {
    name: "Maria",
    age: 28,
    city: "New York"
};
console.log(person.name); // Accessing a property

Keys are always strings (or Symbols, introduced in ES6). When you use non-string values as keys in an object, JavaScript implicitly converts them to strings.

Objects are generally used for a simple dictionary-like structure with string keys.

Git by Patrik
...see more

This short Snipp shows you how to remove the last commit from the git repository.

1. Check the logs

First of all, check your local commit with messages before removing the last commit. Run the following command to check the logs in one line.

git log --oneline

2. Remove the last commit from the local branch

Now, Run the following command to remove the last commit and discard the changes from the local branch.

git reset --hard HEAD~1

Checkout the different ways to Undo commit before push in Git.

3. Update remote repository

At last, we will update the files and again need to push with force. It will delete the previous commit and keep a new one on the remote git repository.

git push origin <name_of_branch> -f

Now you can check the logs to verify the commit in the git repository.

Git by Patrik
...see more

The main workflow for a developer will follow these steps

  1. Create a branch for the changes to be made and give it a name according to the naming convention.
  2. Commit changes to the branch. There are often multiple commits for a bug fix or feature.
  3. Push the branch to the remote repository.
  4. Create a pull request so other team members can review the changes. To incorporate feedback, more commits might be needed and changes to be pushed.
  5. Complete the pull request and resolve any merge conflicts from changes other team members made after creating the branch.
Git by Cole
...see more

This is an elementary guide to Git for beginners. Git is a version-control system for tracking changes in files associated with projects of different types. It is primarily used for source-code management in software development, but it can be used to keep track of changes in any set of files.

Without a version control system, you probably used to frequently save copies of your work-in-progress in zip files. But when you feel that your work is a mess and you need to get back to a previous version of some files, how to deal with mixed changes in files? It’s a real pain to do that. Git and other version control systems like SVN are a great solution.

EF Core by Patrik
...see more

In this example, you can see how you can manually manage a transaction around your database operations, providing more fine-grained control when needed. However, for most scenarios, the default behavior of wrapping SaveChanges in a transaction is sufficient.

using (var dbContext = new YourDbContext())
{
    using (var transaction = dbContext.Database.BeginTransaction())
    {
        try
        {
            // Perform your database operations here

            dbContext.SaveChanges();

            // If everything is successful, commit the transaction
            transaction.Commit();
        }
        catch (Exception ex)
        {
            // Handle exceptions and optionally roll back the transaction
            transaction.Rollback();
        }
    }
}

In this example, you can see how you can manually manage a transaction around your database operations, providing more fine-grained control when needed. However, for most scenarios, the default behavior of wrapping SaveChanges in a transaction is sufficient.

EF Core by Patrik
...see more

Entity Framework Core (EF Core) does wrap the SaveChanges method in a transaction by default. When you call SaveChanges to persist changes to the database, EF Core ensures that all the changes are committed as a single transaction. This means that if any part of the operation fails (e.g., due to a validation error or a database constraint violation), none of the changes will be applied to the database.

Here's how it works:

  1. You make changes to your entity objects within a DbContext.
  2. When you call SaveChanges, EF Core starts a database transaction.
  3. EF Core applies all the changes to the database within this transaction.
  4. If all changes are successfully applied, the transaction is committed, making the changes permanent.
  5. If any part of the operation fails (e.g., an exception is thrown), the transaction is rolled back, and no changes are applied to the database.

This behavior ensures that your data remains in a consistent state, and either all changes are applied or none are. If you need more control over transactions, such as specifying isolation levels or manually managing transactions, EF Core provides options for doing so. You can use methods like BeginTransaction, Commit, and Rollback on the DbContext's Database property to work with transactions explicitly.

EF Core by Patrik
...see more

EF Core Migrations is a feature that helps manage database schema changes. It allows developers to easily create, update, and rollback database migrations using a code-first approach, ensuring that your database schema stays in sync with your application models.

Add to Set
  • .NET
  • .NET 6.0 Migration
  • 5 Best websites to read books online free with no downloads
  • 5 surprising things that men find unattractive
  • 5 Ways To Take Control of Overthinking
  • 6 simple methods for a more productive workday
  • 6 Ways To Stop Stressing About Things You Can't Control
  • Add React to ASP.NET Core
  • Adding reCAPTCHA to a .NET Core Web Site
  • Admin Accounts
  • Adobe Acrobat
  • Afraid of the new job? 7 positive tips against negative feelings
  • Agile
  • AI
  • AKS and Kubernetes Commands (kubectl)
  • API Lifecycle Management
  • Application Insights
  • arc42
  • Architectures
  • Article Writing Tools
  • ASP.NET Core Code Snippets
  • ASP.NET Core Performance Best Practices
  • ASP.NET Core Razor Pages
  • ASP.NET: Razor Syntax Cheat Sheet
  • Atlassian
  • Azure
  • Azure API Management
  • Azure App Registration
  • Azure Application Gateway
  • Azure Arc
  • Azure Arc Commands
  • Azure Architectures
  • Azure Bastion
  • Azure Bicep
  • Azure CLI Commands
  • Azure Cloud Products
  • Azure Cognitive Services
  • Azure Container Apps
  • Azure Cosmos DB
  • Azure Cosmos DB Commands
  • Azure Costs
  • Azure Daily
  • Azure Daily 2022
  • Azure Daily 2023
  • Azure Data Factory
  • Azure Database for MySQL
  • Azure Database for PostgreSQL
  • Azure Databricks
  • Azure Diagram Samples
  • Azure Durable Functions
  • Azure Firewall
  • Azure Functions
  • Azure Kubernetes Service (AKS)
  • Azure Landing Zone
  • Azure Log Analytics
  • Azure Logic Apps
  • Azure Maps
  • Azure Monitor
  • Azure News
  • Azure PowerShell Cmdlets
  • Azure PowerShell Login
  • Azure Private Link
  • Azure Purview
  • Azure Redis Cache
  • Azure Security Groups
  • Azure Sentinel
  • Azure Service Bus
  • Azure Service Bus Questions (FAQ)
  • Azure Services Abstract
  • Azure SQL
  • Azure Storage Account
  • Azure Tips and Tricks
  • Backlog Items
  • BASH Programming
  • Best LinkedIn Tips (Demo Test)
  • Best Practices for RESTful API
  • Bing Maps
  • Birthday Gift Ideas for Wife
  • Birthday Poems
  • Black Backgrounds and Wallpapers
  • Bootstrap Templates
  • Brave New World
  • Break Out of a JavaScript Loop
  • Brian Tracy Quotes
  • Build Websites Resources
  • C# Code Samples
  • C# Design Patterns
  • C# Development Issues
  • C# Programming Guide
  • Caching
  • Caching Patterns
  • Camping Trip Checklist
  • Canary Deployment
  • Careers of the Future You Should Know About
  • Cheap Vacation Ideas
  • Cloud Computing
  • Cloud Migration Methods
  • Cloud Native Applications
  • Cloud Service Models
  • Cloudflare
  • Code Snippets
  • Collection in JavaScript
  • Compelling Reasons Why Money Can’t Buy Happiness
  • Conditional Access
  • Configurations for Application Insights
  • Const in JavaScript
  • Create a Routine
  • Create sitemap.xml in ASP.NET Core
  • Creative Writing: Exercises for creative texts
  • CSS Selectors Cheat Sheet
  • Cultivate a Growth Mindset
  • Cultivate a Growth Mindset by Stealing From Silicon Valley
  • Custom Script Extension for Windows
  • Daily Scrum (Meeting)
  • Dalai Lama Quotes
  • Data Generators
  • DataGridView
  • Decision Trees
  • Deployments in Azure
  • Dev Box
  • Develop ASP.NET Core with React
  • Development Flows
  • Docker
  • Don’t End a Meeting Without Doing These 3 Things
  • Drink More Water: This is How it Works
  • Dropdown Filter
  • Earl Nightingale Quotes
  • Easy Steps Towards Energy Efficiency
  • EF Core
  • Elon Musk
  • Elon Musk Companies
  • Employment
  • English
  • Entity Framework Core: Syntax and Commands
  • Escape Double Quotes in C#
  • Escaping characters in C#
  • Executing Raw SQL Queries using Entity Framework Core
  • Factors to Consider While Selecting the Best Earthmoving System
  • Feng Shui 101: How to Harmonize Your Home in the New Year
  • Flying Machines
  • Foods against cravings
  • Foods that cool you from the inside
  • Four Misconceptions About Drinking
  • Fox News
  • Free APIs
  • Funny Life Quotes
  • Generate Faces
  • Generate Random Numbers in C#
  • Genius Money Hacks for Massive Savings
  • Git
  • Git Cheat Sheet
  • Git for Beginners
  • Git Fork
  • GitHub
  • GitHub Concepts
  • Green Careers Set to Grow in the Next Decade
  • Habits Of Highly Stressed People and how to avoid them
  • Happy Birthday Wishes & Quotes
  • Helm Overview
  • How to Clean Floors – Tips & Tricks
  • How to invest during the 2021 pandemic
  • How To Make Money From Real Estate
  • How To Stop Drinking Coffee
  • HTTP Status Code
  • Image for Websites
  • Inspirational Quotes
  • Iqra Technology, IT Services provider Company
  • JavaScript
  • JavaScript Scope
  • JavaScript Snippets
  • JavaScript Var, Let, and Const
  • Jobs Of 2050
  • jQuery
  • jQuery plugins
  • JSON (JavaScript Object Notation)
  • JSON for Linking Data (JSON-LD)
  • Json to C# Converters
  • JSON Tree Viewer JavaScript Plugin
  • JSX (ReactJS)
  • Karen Lamb Quotes
  • Kubernetes Objects
  • Kubernetes Tools
  • Kusto Query Language
  • Lack of time at work? 5 simple tricks to help you avoid stress
  • Lambda (C#)
  • Last Minute Travel Tips
  • Last-Minute-Reisetipps
  • Latest Robotics
  • Leadership
  • Let in JavaScript
  • List Of Hobbies And Interests
  • Logitech BRIO Webcam
  • Management
  • Mark Twain Quotes
  • Markdown
  • Meet Sophia
  • Message-Oriented Architecture
  • Microservices
  • Microsoft Authenticator App
  • Microsoft Power Automate
  • Microsoft SQL Server
  • Microsoft Teams
  • Mobile UI Frameworks
  • Motivation
  • Multilingual Applications
  • NBC News
  • NuGet
  • OAuth Authentication Flows
  • Objectives and Key Results (OKR)
  • Objectives and Key Results (OKR) Samples
  • OKR Software
  • Online JSON Viewer and Parser
  • Outlook Automation
  • PCMag
  • Phases of any relationship
  • Playwright
  • Popular cars per decade
  • Popular Quotes
  • PowerShell
  • PowerShell Array Guide
  • PowerShell Cmdlets
  • PowerShell Coding Samples
  • PowerToys
  • Prism
  • Pros & Cons Of Alternative Energy
  • Quill Rich Text Editor
  • Quotes
  • RACI Matrix
  • Razor Syntax
  • Reasons why singletasking is better than multitasking
  • Regular Expression (RegEx)
  • Reorder List in JavaScript
  • Resize Images in C#
  • Response Caching in ASP.NET Core
  • RESTful APIs
  • Rich Text Editors
  • Rob Siltanen Quotes
  • Robots
  • Run sudo commands
  • Salesforce Offshore Support Services Providers
  • Sample Data
  • Save Money On Food
  • Score with authenticity in the job interview
  • Scrum
  • Scrum Meetings
  • Security
  • Semantic Versioning
  • Serialization using Thread Synchronization
  • Service Worker
  • Snipps
  • Speak and Presentation
  • SQL Functions
  • SQL References
  • SQL Server Full-Text Search
  • Successful
  • Surface Lineup 2021
  • Surface Lineup 2021 Videos
  • SVG Online Editors
  • Team Manifesto
  • Technologies
  • Technology Abbreviations
  • Technology Glossary
  • TechSpot
  • That is why you should drink cucumber water every day
  • The Cache Tag Helper in ASP.NET Core
  • The Verge
  • Theodore Roosevelt Quotes
  • These 7 things make you unattractive
  • Things Successful People Do That Others Don’t
  • Things to Consider for a Great Birthday Party
  • Things to Consider When Designing A Website
  • Thoughts
  • TinyMCE Image Options
  • TinyMCE Toolbar Options
  • Tips for a Joyful Life
  • Tips for fewer emails at work
  • Tips for Making Better Decisions
  • Tips for Managing the Stress of Working at Home
  • Tips for Writing that Great Blog Post
  • Tips On Giving Flowers As Gifts
  • Tips you will listen better
  • Top Fitness Tips
  • Top Healthy Tips
  • Top Money Tips
  • Top Ten Jobs
  • Track Authenticated Users in Application Insights
  • Unicode Characters
  • Var in JavaScript
  • Visual Studio 2022
  • Vital everyday work: tips for healthy work
  • Walking barefoot strengthens your immune system
  • Walt Disney Quotes
  • Ways for Kids to Make Money
  • Web Design Trends & Ideas
  • Web Icons
  • Web Scraping
  • Webhooks
  • Website Feature Development
  • What are my options for investing money?
  • What happens when you drink water in the morning
  • What Is Stressful About Working at Home
  • What To Eat For Lunch
  • Windows
  • Windows 11 Top Features You Should Know
  • Winston Churchill Quotes
  • XPath
  • You'll burn out your team with these 5 leadership mistakes
  • ZDNet
 
Sets