Skip to content

Instantly share code, notes, and snippets.

View kierunb's full-sized avatar
💭
Any sufficiently advanced bug is indistinguishable from a feature.

Bartek kierunb

💭
Any sufficiently advanced bug is indistinguishable from a feature.
View GitHub Profile
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { NavMenuComponent } from './nav-menu/nav-menu.component';
import { HomeComponent } from './home/home.component';
import { CounterComponent } from './counter/counter.component';
@kierunb
kierunb / workshop-11-10.md
Last active October 11, 2019 10:00
workshop-11-10

Notes


klasa DBContext

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.SqlServer;
using System;
using System.Collections.Generic;
@kierunb
kierunb / 9-10-19.md
Last active October 9, 2019 07:16
9-10-19

data access

polecenia:

  • dotnet new webapi -o webapi-ef-core
  • dotnet add package Microsoft.EntityFrameworkCore.SqlServer

zakładamy nowy plik .cs:

using System.Collections.Generic;
<target name="database" xsi:type="Database">
<connectionString>server=localhost;Database=*****;user id=****;password=*****</connectionString>
<!--
Script for creating the dbo.Log table.
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [dbo].[Log] (
[Id] [int] IDENTITY(1,1) NOT NULL,
// w pliku html
<div style="height: 600px;"
leaflet
[leafletOptions]="options">
</div>
// w pliku .ts
options = {
layers: [
tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: '...' })
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
private object GenerateJwtToken(string userName, CommandoUser user)
{
var claims = new List<Claim>
{
new Claim("username", userName),
new Claim(JwtRegisteredClaimNames.Sub, userName),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(ClaimTypes.NameIdentifier, user.UserName),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", userName)
};
https://joonasw.net/view/apply-authz-by-default
"JwtConfig":{
"JwtKey": "superSecretKey@123456",
"JwtIssuer": "http://localhost:5000",
"JwtExpireDays": 30
}
VS Code
Node 8.x
a potem w kosoli:
npm install -g yo gulp
npm install -g @microsoft/generator-sharepoint
npm install -g @pnp/generator-spfx
@kierunb
kierunb / iis-express.bat
Created April 26, 2019 13:03
script to run iis express in local folder
SET EX="C:\Program Files\IIS Express\iisexpress.exe"
if not "%1" == "" (
CALL %EX% /path:%CD% /port:%1
) else (
CALL %EX% /path:%CD%
)