Skip to content

Instantly share code, notes, and snippets.

View nh43de's full-sized avatar
🏠
Working from home

Nathan Hollis nh43de

🏠
Working from home
View GitHub Profile
@ThiagoBarradas
ThiagoBarradas / xunit-theory-memberdata.cs
Last active March 6, 2023 17:50
xUnit Theory MemberData Sample
// models for example
public class SendEmailModel
{
public string Content { get; set; }
public string Email { get; set; }
}
public class SendEmailResult
@SteveSandersonMS
SteveSandersonMS / blazor-auth.md
Created June 11, 2019 10:49
Blazor authentication and authorization

Authentication and Authorization

Authentication means determining who a particular user is. Authorization means applying rules about what they can do. Blazor contains features for handling both aspects of this.

It worth remembering how the overall goals differ between server-side Blazor and client-side Blazor:

  • Server-side Blazor applications run on the server. As such, correctly-implemented authorization checks are both how you determine which UI options to show (e.g., which menu entries are available to a certain user) and where you actually enforce access rules.
  • Client-side Blazor applications run on the client. As such, authorization is only used as a way of determining what UI options to show (e.g., which menu entries). The actual enforcement of authorization rules must be implemented on whatever backend server your application operates on, since any client-side checks can be modified or bypassed.

Authentication-enabled templates for Server-Side Blazor

@amonks
amonks / monad.js
Created July 19, 2016 08:37
How to work with Monads IRL // Chaining in JavaScript
/* How to work with Monads IRL // Chaining in JavaScript
* by Andrew Monks // https://monks.com/monads
*
* try it in your browser:
* https://tonicdev.com/amonks/578beb1fdb37ac12001d3826
Have you ever chained a bunch of functions together?
Math.log(Math.floor(Math.sqrt(Math.random())))
anonymous
anonymous / Funky Clouds 2014
Created May 7, 2014 07:35
Funky Clouds 2014 - Toys For Matrix Effects
/*
Funky Clouds 2014
Toys For Matrix Effects
www.stefan-petrick.de/wordpress_beta
*/
@niksumeiko
niksumeiko / git.migrate
Last active April 30, 2024 12:54
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@pazdera
pazdera / gist:1098119
Created July 21, 2011 20:25
Singleton example in C++
/*
* Example of a singleton design pattern.
* Copyright (C) 2011 Radek Pazdera
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,