Skip to content

Instantly share code, notes, and snippets.

View aaa.js
async update({ commit }, { token, password })
{
const result = await axios.put(
passwordChangeUrl,
{ token, password },
{ validateStatus: status => status === 404 || status === 400 }
)
switch (result.status) {
case 404:
commit("login is expired")
View test.json
{
"test": 555,
"content": {
"name": "AAA",
"age": 55
}
}
View Program.cs
internal class Program
{
#pragma warning disable VSTHRD200
private static async Task Main(string[] args)
{
await Task.CompletedTask;
Console.WriteLine("Hello World!");
}
#pragma warning restore VSTHRD200
}
View Directory.Build.props
<Project>
<PropertyGroup>
<LangVersion>preview</LangVersion> <!--Set C# version for every projects-->
<Nullable>enable</Nullable> <!--Enable nullable for projects-->
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Solution.ruleset</CodeAnalysisRuleSet> <!--Path to Solution.ruleset config for analyzers-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.5.132" /> <!--some analyzer from nuget https://www.nuget.org/packages/Microsoft.VisualStudio.Threading.Analyzers/ -->
</ItemGroup>
@PadreSVK
PadreSVK / extensions.ps1
Created Mar 6, 2020
Recommend extesions
View extensions.ps1
# sync settings for vscode based on github gists
code --install-extension shan.code-settings-sync
# vuejs extesion
code --install-extension octref.vetur
# javascript/typescript playground https://quokkajs.com/
code --install-extension wallabyjs.quokka-vscode
# liveshare for vscode => welcome eXtreme programming
View script.py
import pandas as pd
import csv
import matplotlib.pyplot as plt
from scipy import signal
x = []
y = []
z = []
xOffset = None
@PadreSVK
PadreSVK / Startup.cs
Created Dec 16, 2019
Register cookie auth in startup
View Startup.cs
///
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie();
services.ConfigureApplicationCookie(options =>
@PadreSVK
PadreSVK / AccountController.cs
Created Dec 16, 2019
Login controller and views
View AccountController.cs
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using BL;
using DAL.Models.Identity;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
@PadreSVK
PadreSVK / script.js
Created Dec 15, 2019
Get data from server
View script.js
document.cookie
const response = await fetch('https://localhost:5001/weather/GetAllCities', {method: "POST"});
const myJson = await response.json();
console.log(JSON.stringify(myJson));
fetch('https://localhost:5001/weather', {method: "POST"})
.then(response => response.json())
.then(json=> console.log(JSON.stringify(json)))
You can’t perform that action at this time.