Skip to content

Instantly share code, notes, and snippets.

View amitsinghrawat1994's full-sized avatar

Amit Singh Rawat amitsinghrawat1994

View GitHub Profile
@amitsinghrawat1994
amitsinghrawat1994 / README.md
Created April 13, 2024 15:50 — forked from qti3e/README.md
List of file signatures and mime types based on file extensions
@amitsinghrawat1994
amitsinghrawat1994 / docker-compose.yml
Created July 27, 2022 15:13
Angular , Dotnet core docker componse
# Ref:https://github.com/DanWahlin/Angular-Docker-Microservices/blob/master/docker-compose.yml
# Run docker-compose build
# Run docker-compose up
# Live long and prosper
version: '3.1'
services:
nginx:
@amitsinghrawat1994
amitsinghrawat1994 / gist:a0a079ec81dfe39462c81a1dd637d77b
Created March 3, 2022 04:06
Clean node modules reinstall in window
Ref: https://stackoverflow.com/a/68958342/7961948
deleted the node modules and package.lock.json
deleted npm and npm-cahce folder in C:\Users\user\AppData\Roaming and rebooted the PC
Then ran npm cache clean to make sure the cache was correctly cleaned.
Updated the react and react-dom version to ^17.0.0
Updated my npm version to the most recent too, perhaps this might not be a reason for the error, but i found useful to perform the update.
After that i ran:
npm install
// ref: https://github.com/jbogard/MediatR/issues/46
//Arrange
var mediator = new Mock<IMediator>();
mediator.Setup(m => m.Send(It.IsAny<QueryModel>(), It.IsAny<CancellationToken>())).ReturnsAsync(It.IsAny<ExpectedResultModel>());
//Act
await mediator.Object.Send(new QueryModel());
//Assert
// Ref: https://github.com/garronej/tss-react/blob/main/src/mui.ts
// custom hooks for tss-react to expose makeStyles and etc
import { useTheme } from "@mui/material/styles";
import { createMakeAndWithStyles } from "./index";
/** @see <https://docs.tss-react.dev/setup> */
export const { makeStyles, withStyles, useStyles } = createMakeAndWithStyles({
useTheme,
});
// Ref: https://github.com/devias-io/material-kit-react/blob/main/src/theme/index.js
import { createTheme } from '@mui/material';
export const theme = createTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 1000,
@amitsinghrawat1994
amitsinghrawat1994 / gist:31bd296ae051bf9729431712d79d02fd
Last active January 30, 2022 11:20
Add a custom variable in Material UI version 4
// add a custom variable in Material ui
// ref: https://github.com/mui-org/material-ui/issues/13802#issuecomment-444200131
import createMuiTheme from "@material-ui/core/styles/createMuiTheme";
import { PaletteColor, PaletteColorOptions } from "@material-ui/core/styles/createPalette";
declare module "@material-ui/core/styles/createPalette" {
interface Palette {
blue: PaletteColor;
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 = {