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 / CascadeDeleteAttribute.cs
Created January 10, 2019 22:28 — forked from tystol/CascadeDeleteAttribute.cs
Entity Framework CascadeDelete using Data Annotations
using System;
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class CascadeDeleteAttribute : Attribute { }
@uzbekdev1
uzbekdev1 / what-forces-layout.md
Created January 15, 2019 12:27 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@uzbekdev1
uzbekdev1 / CasecadeDelete.sql
Created January 15, 2019 19:49 — forked from lionofdezert/CasecadeDelete.sql
Casecade Delete in SQL Server
USE AdventureWorks
GO
--============== Supporting function dbo.udfGetFullQualName
IF OBJECT_ID('dbo.udfGetFullQualName') IS NOT NULL
DROP FUNCTION dbo.udfGetFullQualName
GO
CREATE FUNCTION dbo.udfGetFullQualName ( @ObjectId INTEGER )
import {
Directive, TemplateRef, Input, ChangeDetectorRef, ViewContainerRef,
IterableDiffers, OnChanges, SimpleChanges, SimpleChange
} from '@angular/core';
import { NgFor } from "@angular/common";
import { NgForRow } from "@angular/common/src/directives/ng_for";
@Directive({
selector: '[ngFor][ngForIn]'
})
@uzbekdev1
uzbekdev1 / UZB Sum Numeric Inputmask
Created January 30, 2019 12:36
UZB SUM Curerncy Inputmask
<input type="text" id="price1" placeholder="Меньше 29.98" />
<script src="/Scripts/Inputmask/min/jquery.inputmask.bundle.min.js"></script>
<script>
$(document).ready(function () {
$("#price1").inputmask("decimal", {
max:parseFloat("29,98".Replace(",","."))).toFixed(2),
radixPoint: ",",
digits: 2,
@uzbekdev1
uzbekdev1 / Sort Types
Created January 30, 2019 12:45
Listing Sort Types
Featured (based on product sort order number)
Newest Items
Best Selling
Alphabetical (A-Z)
Alphabetical (Z-A)
Average customer review
Price (Low to High)
Price (High to Low)
@uzbekdev1
uzbekdev1 / Select only one checkbox in a group
Created February 1, 2019 09:34
Select only one checkbox in a group
$("input:checkbox").on('click', function() {
var $box = $(this);
if ($box.is(":checked")) {
var group = "input:checkbox[name='" + $box.attr("name") + "']";
$(group).prop("checked", false);
$box.prop("checked", true);
} else {
@uzbekdev1
uzbekdev1 / Current directory in C#
Created February 2, 2019 13:13
Current directory in C#
System.AppContext.BaseDirectory
This is the prefered replacement for AppDomain.CurrentDomain.BaseDirectory in .net core (at least until the API appears for AppDomain, if it ever will).
AppDomain.CurrentDomain.BaseDirectory
This is the best option all round. It will give you the base directory for class libraries, including those in ASP.NET applications.
Directory.GetCurrentDirectory()
This does an interop call using the winapi GetCurrentDirectory call inside kernel32.dll, which means the launching process’ folder will often be returned. Also as the MSDN documents say, it’s not guaranteed to work on mobile devices.
@uzbekdev1
uzbekdev1 / Program.cs
Created February 14, 2019 11:13 — forked from open-ruic/Program.cs
C# RSA Key Utils
using System;
namespace PKCS1ToPKCS8Application
{
class Program
{
static void Main(string[] args)
{
byte[] importedPrivateKeyBytes = Convert.FromBase64String("MIIEowIBAAKCAQEAtuHuMvnE3fYz/eom8mF7xxLXPETjfUpVYHL6AUVwXKKCrZ6uFszh2bY7ADoiIpuPTS0NVNYeKLlu6T59qzyr0bnT8KgXdZJFVzYWIh8VOLTb2zghlu8BeBoJP9t/a34Mj7gGJUZWBgECopEGCXrFwyIvXSW0JU5YrJinyyPhUjUXLeyowJUXoLwEafOHBRRiZZv1SNlntQOAenHFB/1uv2Y5xmdHm7xl+jjeo469u+pY535RCekmam9hWbZcn/WZEf9BZEmE2i4v7Qj72V92LrSUSSjF6w6lgU3B+Byu0XR8ZeUjD+FP9ZKvJyEtxlxOVaADQ+/udghUr1PnfXIHRQIDAQABAoIBAHG1UBFJ0unfJrx9VfHmQruoL0M94eQIz8TEOEWKEy7FrFKfEscCZHqlH1Io0wiJiDQICv3wk5fmk9taC3DorDweOnSrTsq/Q3XSHzjf8qXrbbeD0v6xZEx0g8O8iiEfolfJp6iNbvcUsbq6SPKj70pAewqDYtq/N8s4rztS98nQQ5PAQ10Zv3X910lc0vnPlPKew4y7w6hwb/pbiEBLbbV9tYAVaAm63n/EYxjo3UCRA0BJZxhJbRdEQzCEzClXlo6txx7nGQz/omv574P22ASCAfyrFNhaT20DR+ilIXe+edBpJehD6Q/lpO56STawb9xCAk6+aerM5dcIBMTETRECgYEA3RdnfpY1Z8KtOT1rVUeI094vylP1HONrcXNSsV0sbNPSwoK91UpO0mfsLLWxLtjvX52yixhfKxQ0QLYq3nyC8SRj2GE07aO1HZ81MI/9Y6ynJkw+
@uzbekdev1
uzbekdev1 / gist:66aa4d2ee9a66206f486bf62aaa16d55
Created February 22, 2019 10:10 — forked from zelid/gist:6965002
Examples of BulkInsert for PostgreSQL, MySQL and MS SQL using ServiceStack OrmLite. Work in progress...
public static void BulkInsertNpgsql<T>(this IDbConnection dbConn, IEnumerable<T> list, IEnumerable<string> insertFields = null)
{
if (list == null) return;
if (list.Count() < 1) return;
var objWithAttributes = list.FirstOrDefault();
var modelDef = OrmLiteConfig.GetModelDefinition(objWithAttributes.GetType());
if (insertFields == null) insertFields = new List<string>();