Skip to content

Instantly share code, notes, and snippets.

View orion55's full-sized avatar

Orion55 orion55

  • 23:16 (UTC +05:00)
View GitHub Profile
@orion55
orion55 / date.js
Created May 20, 2022 18:08
Convert Date from ISO to JS Date without zone
DateTime.fromISO(creationDate).toUTC().setZone("local", { keepLocalTime: true }).toJSDate()
@orion55
orion55 / toggle.js
Created April 7, 2022 05:13
Closure (PART 2)
function toggle(...vals) {
var unset = {};
var cur = unset;
return function next(){
// save previous value back at
// the end of the list
if (cur != unset) {
vals.push(cur);
}
@orion55
orion55 / vert.scss
Created January 18, 2022 06:19
Отобразить первые 3 строки текста
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
@orion55
orion55 / blue.scss
Created October 2, 2021 13:33
Отключить встроенный голубой цвет у input
&:-webkit-autofill,
&:-webkit-autofill:hover,
&:-webkit-autofill:focus {
border: 0;
-webkit-text-fill-color: $white;
-webkit-box-shadow: 0 0 0 1000px transparent inset;
transition: background-color 5000s ease-in-out 0s;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(0, 174, 255, 0.04) 50%, rgba(255, 255, 255, 0) 51%, rgba(0, 174, 255, 0.03) 100%);
}
@orion55
orion55 / input-field.tsx
Created October 1, 2021 11:24
Material design input field
import React from "react";
import styles from './styles.module.scss';
import classNames from "classnames/bind";
interface Props {
label: string;
inputType?: 'text' | 'number' | 'email';
className?: string;
isValid?: boolean;
}
@orion55
orion55 / getparam.cs
Created September 24, 2021 05:07
Get Param From Url
private int GetParamFromUrl(string url)
{
Uri myUri = new Uri(NnmClub + url);
string param = HttpUtility.ParseQueryString(myUri.Query).Get("t");
return ToInt32(param);
}
@orion55
orion55 / decode.cs
Last active September 24, 2021 04:32
Decode text from 1251 to utf-8
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
private string DecodeText(string text)
{
var encFrom = Encoding.GetEncoding("windows-1251");
var encTo = Encoding.GetEncoding("utf-8");
byte[] bytes = encFrom.GetBytes(text);
bytes = Encoding.Convert(encFrom, encTo, bytes);
return encTo.GetString(bytes);
}
@orion55
orion55 / migrations-remove.sh
Created September 1, 2021 05:14
Remove migrations
dotnet ef database update 0
dotnet ef migrations remove
@orion55
orion55 / dotnet-ef.sh
Created September 1, 2021 05:03
Update dotnet-ef
dotnet tool update --global dotnet-ef
@orion55
orion55 / migrations.sh
Last active September 29, 2022 09:05
Add migrations
$env:ConnectionStrings__DefaultConnection = "Host=localhost;Port=5432;Database=linksdb;Username=postgres;Password=admin"
dotnet ef migrations add InitialCreate
dotnet ef database update
dotnet ef migrations add InitialCreate -p LinkShortener.Db -s LinkShortener.API
dotnet ef database update -p LinkShortener.Db -s LinkShortener.API