Skip to content

Instantly share code, notes, and snippets.

View uzbekdev1's full-sized avatar
🌴
On vacation

Elyor Latipov uzbekdev1

🌴
On vacation
View GitHub Profile
@uzbekdev1
uzbekdev1 / Guid.ts
Created June 6, 2022 13:44 — forked from emptyother/Guid.ts
GUID class for Typescript
class Guid {
public static newGuid(): Guid {
return new Guid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = (c == 'x') ? r : (r & 0x3 | 0x8);
return v.toString(16);
}));
}
public static get empty(): string {
return '00000000-0000-0000-0000-000000000000';
SQL Server 2017
----------------
Enterprise Core - 6GPYM-VHN83-PHDM2-Q9T2R-KBV83
Developer - 22222-00000-00000-00000-00000
Enterprise - TDKQD-PKV44-PJT4N-TCJG2-3YJ6B
Standard - PHDV4-3VJWD-N7JVP-FGPKY-XBV89
Web - WV79P-7K6YG-T7QFN-M3WHF-37BXC
https://www.teamos-hkrg.com/index.php?threads/microsoft-sql-server-english-2017-rtm-teamos.42103/
Visual Studio 2022
Enterprise :
VHF9H-NXBBB-638P6-6JHCY-88JWH
Professional:
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
SQL Server 2017
----------------
Enterprise Core - 6GPYM-VHN83-PHDM2-Q9T2R-KBV83
@uzbekdev1
uzbekdev1 / HttpContextCurrentTests.cs
Created January 24, 2022 08:02 — forked from lkaczanowski/HttpContextCurrentTests.cs
Creates HttpContext with Session to stub HttpContext.Current
using System.IO;
using System.Reflection;
using System.Web;
using System.Web.SessionState;
using NUnit.Framework;
namespace Mvc.Tests
{
[TestFixture]
@uzbekdev1
uzbekdev1 / gulp.js
Created January 11, 2022 23:14
gulp dest in the same directory
gulp.dest(function(file){ return file.base; })
@uzbekdev1
uzbekdev1 / web.config
Created January 8, 2022 17:33
force HTTPS .net project redirection
<system.webServer>
<rewrite>
<rules>
<rule name="https redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
@uzbekdev1
uzbekdev1 / response.cs
Created January 8, 2022 12:29
Minimally rest api response
public class RestReponseDto<T> where T:class
{
string ErrorMessage{get;set;}
bool IsSuccess{get;set;}
T ResultData{get;set;}
}
public class Solution {
public int CalPoints(string[] ops) {
var score = new List<int>();
for (int i = 0; i < ops.Length; i++)
{
string c = ops[i];
if (c == "+")
{
# Method: POST
# Headers
# Authorization Bearer eyJhbGciO... (access token)
# Content-Type: application/json
# Body
# {
# "username": "test-user",
# "groups": ["Comp1"], // doesn't work, even if it is in the docs
# "lastName": "test",
@uzbekdev1
uzbekdev1 / startup.cs
Last active November 19, 2021 12:39
keycloack auth .net core api
//ConfigureServices
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.MetadataAddress = "https://{host}/auth/realms/{realm}/.well-known/openid-configuration";
options.RequireHttpsMetadata = true;
options.IncludeErrorDetails = true;
options.SaveToken = true;