Skip to content

Instantly share code, notes, and snippets.

View amitsinghrawat1994's full-sized avatar

Amit Singh Rawat amitsinghrawat1994

View GitHub Profile
import {useState, useEffect} from 'react';
export const useGetJokes = () : [() => Promise<void>, string[], boolean, string] =>{
const [joke, setJoke] = useState(['']);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState('');
const endpoint = 'https://sv443.net/jokeapi/v2/joke/Any?blacklistFlags=racist&type=single';
const getJoke = async () => {
@amitsinghrawat1994
amitsinghrawat1994 / ApplicationDbContext.cs
Created June 11, 2021 03:11 — forked from DiomedesDominguez/ApplicationDbContext.cs
The main goal of ModelBuilderExtentions.cs is to use DataAnnotations more in our tables instead of using Fluent. The other files are mere examples.
namespace MyDotNetCore.App
{
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
@amitsinghrawat1994
amitsinghrawat1994 / DataContext.js
Created November 2, 2020 13:13 — forked from kamranayub/DataContext.js
A working ASP.NET Web API MVC 4 Anti-Forgery approach that also works on cloud hosts like AppHarbor. See: http://kamranicus.com/Blog/Posts/70/protip-using-anti-forgery-token-with-aspnet-web-ap
var options = {};
// jQuery options
// options.url = foo;
// CSRF Token
var csrfToken = $("input[name='__RequestVerificationToken']").val();
if (csrfToken) {
options.headers = {
@DiomedesDominguez
DiomedesDominguez / ApplicationDbContext.cs
Last active June 14, 2025 06:04
The main goal of ModelBuilderExtentions.cs is to use DataAnnotations more in our tables instead of using Fluent. The other files are mere examples.
namespace MyDotNetCore.App
{
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
@hotdang-ca
hotdang-ca / FreeCurrencyConverterService.cs
Created November 6, 2018 22:23
C# Service Wrapper around FreeCurrencyConverterApi
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Script.Serialization;
namespace App.Service.Services
{
public class FreeCurrencyConverterService : IFreeCurrencyConverterService
{
private readonly String BASE_URI = "http://free.currencyconverterapi.com";
@akatakritos
akatakritos / create-aspnet-core-identity-schema.sql
Created June 5, 2018 03:19
Script to create the ASPNET core Identity tables
USE [HobbyDB]
GO
/****** Object: Table [dbo].[AspNetRoleClaims] Script Date: 6/4/2018 10:18:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AspNetRoleClaims]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[AspNetRoleClaims](
@jeroenheijmans
jeroenheijmans / AspNetIdentity-SQL-Scripts.sql
Created January 17, 2018 22:33
SQL DDL scripts for [IdentityServer4 + AspNetIdentity] setup
/*
SQL DDL scripts generated using
dotnet ef database update
for the IdentityServer4.Samples 6_AspNetIdentity quick start. This was run for
commit 0a7400a2ade8c149b3feb08a05bf4423d19ac08c in that repository. It references
- IdentityServer4.AspNetIdentity 2.0.0 including
- Microsoft.AspNetCore.Identity (>= 2.0.1)
@qti3e
qti3e / README.md
Last active January 12, 2026 15:29
List of file signatures and mime types based on file extensions
@lukasrudnik
lukasrudnik / Flexbox Froggy answers
Created May 30, 2017 08:31
Solutions Flexbox Froggy
1) justify-content: flex-end;
2) justify-content: center;
3) justify-content: space-around;
4) justify-content: space-between;
5) align-items: flex-end;
6) align-items: center;
justify-content: center;
7) justify-content: space-around;
8) flex-direction: row-reverse;
9) flex-direction: column;
@kamranayub
kamranayub / DataContext.js
Created April 24, 2013 05:12
A working ASP.NET Web API MVC 4 Anti-Forgery approach that also works on cloud hosts like AppHarbor. See: http://kamranicus.com/Blog/Posts/70/protip-using-anti-forgery-token-with-aspnet-web-ap
var options = {};
// jQuery options
// options.url = foo;
// CSRF Token
var csrfToken = $("input[name='__RequestVerificationToken']").val();
if (csrfToken) {
options.headers = {