Skip to content

Instantly share code, notes, and snippets.

View boban100janovski's full-sized avatar
🎯

Boban Stojanovski boban100janovski

🎯
View GitHub Profile
@eneajaho
eneajaho / config.md
Last active May 15, 2024 16:39
Angular ESLint & Prettier Configuration

Install Angular ESLint

ng add @angular-eslint/schematics

Install Prettier and Prettier-ESLint dependencies

npm install prettier prettier-eslint eslint-config-prettier eslint-plugin-prettier --save-dev

ESLint configuration

Filename: .eslintrc.json

@danielhunex
danielhunex / hosted-services-dotnet-core.md
Last active February 21, 2023 20:48
Hosted Services in .Net Core
 
public class HelloContext
{
   private ISomething _smh ; 
     void Foo(string key)
    {
       switch(key)
        {
 case "A":
@samsch
samsch / stop-using-jwts.md
Last active May 17, 2024 18:24
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@matdcooper
matdcooper / gitflow-cheatsheet.md
Created January 10, 2019 14:50
Git-Flow Cheat-Sheet

Creating git repo

  • Create directory
  • Go into new directory
  • Create bare repo
    • git init --bare
  • Clone repo somewhere
    • git clone <repo>
  • Go into repo folder
  • Create .gitignore file
@qoomon
qoomon / conventional_commit_messages.md
Last active May 18, 2024 20:48
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@nrobinaubertin
nrobinaubertin / app.component.ts
Created January 17, 2017 13:36
Exemple of ngb-date-parser-formatter implementation (ng-bootstrap)
import { NgbDatepickerConfig, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbDateFRParserFormatter } from "./ngb-date-fr-parser-formatter"
@Component({
providers: [{provide: NgbDateParserFormatter, useClass: NgbDateFRParserFormatter}]
})
export class AppComponent {}
[CmdletBinding(SupportsShouldProcess)]
param (
# Only one of these may be used.
[Parameter(ParameterSetName='Major')]
[switch]$Major,
[Parameter(ParameterSetName='Minor')]
[switch]$Minor,
[Parameter(ParameterSetName='Patch')]
[switch]$Patch,
[Parameter(ParameterSetName='Version')]
@adamrecsko
adamrecsko / highlight.pipe.ts
Created May 1, 2016 20:28
Angular2 text highlight pipe
import {PipeTransform, Pipe} from 'angular2/core';
@Pipe({ name: 'highlight' })
export class HighLightPipe implements PipeTransform {
transform(text: string, [search]): string {
return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text;
}
}
/** Usage:
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@jawadatgithub
jawadatgithub / OIDC and OAuth2 Flows.md
Last active February 11, 2024 23:15
Enrich IdentityServer3 Documentation with OIDC (OpenID Connect) and OAuth2 Flows section
Note for community:

A. IdentityServer3 docs, samples and source code use OIDC & OAuth2 terms interchangeably to refer to same thing in many areas. I think that's make sense because OIDC introduced as complement & extension for OAuth2.

B. IdentityServer3, STS, OP, OIDC server, OAuth2 server, CSP, IDP and others: means same thing (software that provide/issue tokens to clients) as explained in [Terminology] (http://identityserver.github.io/Documentation/docs/overview/terminology.html).

C. Grants and flows mean same thing, grant was the common term in OAuth2 specs and flow is the common term in OIDC specs.

D. This document will not focus on custom flow/grant.

E. [Important] Choosing wrong flow leads to security threat.