Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Searching....

Zafar Ansari ansarizafar

💭
Searching....
View GitHub Profile
@ansarizafar
ansarizafar / Accordian.svelte
Created Nov 20, 2020 — forked from matryer/Accordian.svelte
Simple Accordian component for Svelte (from https://firesearch.dev)
View Accordian.svelte
<script lang='ts'>
import { slide } from 'svelte/transition'
export let open: boolean = false
export function toggle() {
open = !open
}
</script>
<a
href='#open'
on:click|preventDefault={ toggle }
@ansarizafar
ansarizafar / visualstudio2019Key.txt
Created Aug 10, 2020 — forked from ch-kashif/visualstudio2019Key.txt
Visual Studio 2019 Product Key
View visualstudio2019Key.txt
Visual Studio 2019 Product Key
[Please Star this gist]
Follow My Account --> https://github.com/ch-kashif @ch-kashif
Lets do a code together
Join Cloud Disk repository --> https://github.com/ch-kashif/CloudDisk
@ansarizafar
ansarizafar / PostgreSQL_index_naming.rst
Created Aug 7, 2020 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember
View PostgreSQL_index_naming.rst

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
View AAA_uuid_generate_v6mc.sql
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- My port of https://github.com/kurttheviking/uuid-with-v6-js
-- A hacky translation of:
-- - http://gh.peabody.io/uuidv6/
-- - https://tools.ietf.org/html/draft-peabody-dispatch-new-uuid-format
CREATE OR REPLACE FUNCTION uuid_v1_to_v6(v1 uuid)
RETURNS uuid AS $$
DECLARE
v6 text;
View generate_sequential_uuid.sql
CREATE OR REPLACE FUNCTION generate_sequential_uuid(p_interval_length int DEFAULT 60)
RETURNS uuid
LANGUAGE plpgsql
AS $$
DECLARE
v_i int;
v_time bigint;
v_bytes int[16] = '{}';
v_hex text[16] = '{}';
BEGIN
@ansarizafar
ansarizafar / ConsoleApp1.csproj
Created Jul 19, 2020 — forked from KelsonBall/ConsoleApp1.csproj
Curly Bracketn't Todos List API in C#
View ConsoleApp1.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ansarizafar
ansarizafar / ModelStateValidationFilter.cs
Created Jun 18, 2020 — forked from Ciantic/ModelStateValidationFilter.cs
Model state validation filter ASP.NET Core
View ModelStateValidationFilter.cs
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Example
{
public class ModelStateValidationFilter : Attribute, IActionFilter
{
public void OnActionExecuting(ActionExecutingContext context)
{
View flutter_device_utils.dart
import 'package:flutter/foundation.dart';
import 'dart:io';
bool get isWeb => kIsWeb;
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid);
bool get isDesktop =>
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux);
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS);
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia);
@ansarizafar
ansarizafar / AutoMigration.cs
Created Apr 2, 2020 — forked from lakeman/AutoMigration.cs
Automatic database migration with EF Core 3.0
View AutoMigration.cs
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Storage;
@ansarizafar
ansarizafar / AutoMigration.cs
Created Apr 2, 2020 — forked from lakeman/AutoMigration.cs
Automatic database migration with EF Core 3.0
View AutoMigration.cs
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Storage;