Skip to content

Instantly share code, notes, and snippets.

View maacpiash's full-sized avatar
🕶️
using System.Reflection;

Ahad Chowdhury maacpiash

🕶️
using System.Reflection;
View GitHub Profile
@davepcallan
davepcallan / Program.cs
Created January 3, 2025 08:42
.NET Rate limiting simple examples
using Microsoft.AspNetCore.RateLimiting;
using System.Threading.RateLimiting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRateLimiter(options =>
{
// 1. Fixed Window Limiter (20 requests per 2 minutes)
// -----------------------------------------------
// |----------------- 2 min -----------------|
@asleepace
asleepace / try.ts
Last active October 28, 2025 07:17
A simple extension for TypeScript which enables the `.try(args)` method on functions. This works for both normal & async functions, and reduces a lot of boilerplate.
// Try.ts
// By Colin Teahan
// August 14th, 2024
//
// This TypeScript file enables usage of the .try() method which will return a result tuple of [T?, Error?]
// from any function or async function. This works by defining a new property on the global Object.prototype
// and then do some type-fu.
//
// Example usage:
// https://www.typescriptlang.org/play/?target=99#code/MYewdgziA2CmB0w4EMBOAKAlAKGwejwAJCAVVAT3gBcJ8jCAhcwgYRgEsxTZkALZMHWIBBAK4BzURCqEAjABYqvADSEATAAY18ukNK92EUuQAOsAMrBU7EzIBm7OIVhhkAIzhGpycbEIg7QiU-agosQgBbWCUQABNCAHcDYF5Ex2hCVGjRVC5kTNgIUWgZKlETJwDCAG0SAH5VAFFUVBBUOoBdPTtWiMIBZjtRMGAqdnB-VH6IchHCIZGx8Hh9Q0S2gGsjN2ZY2AcwTnF+wjBYBMITVrNUKmYJ4MJxaBA3ZAyAeTcAK1hR+CuICoQNMsD0AniwS4sRAhCgUSCoIAtEN4LoCMRGgAPZARCp+by+ABc6PoC1G4y4vioAFUILBUEwAJKxdDsWJE06iCJuBmYQgAbz0xGI7ECbPiAB4ALyEDT8pStC5nC7NVoYADknAAbu92YQpAzCOyNTgMSLiFkyrlBadcbBORqGK8Nap9QBfPSegh6UCQGTVQ2oVQM9UdQiy6l0hnM2KhcjoeWESVIpHOFptNLQDK8grWs6xX3gaQ1IMhjOocOR6LRxnkFnx9CyfkptNBwhOl3GoxWnIF0nEAByHxIjU5JAMRjW0nSJwSm2NXEB4iyECMEO7pyBcNE
@davidfowl
davidfowl / MinimalAPIs.md
Last active September 25, 2025 20:44
Minimal APIs at a glance
@iam-doctor-j
iam-doctor-j / DataTable.tsx
Created February 27, 2021 16:07
DataTable component for React using MaterialUI
import { createStyles, Paper, Table, TableBody, TableContainer, TablePagination, Theme } from '@material-ui/core';
import { makeStyles, TableCell, TableHead, TableRow, TableSortLabel } from '@material-ui/core';
import React from 'react';
interface IDataTableColumn {
id: string
name: string,
enableSort?: boolean,
align?: "center" | "inherit" | "justify" | "left" | "right"
}
@davidfowl
davidfowl / server.cs
Last active September 20, 2021 13:56 — forked from DamianEdwards/server.cs
Simplified ASP.NET Core app exploration
#!/usr/bin/env dotnet run
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
var connString = config["connectionString"] ?? "Data Source=todos.db";
builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString));
builder.AddSqlite<Todo>(connString) // Higher level API perhaps?
var app = builder.Build();
@croaky
croaky / App.tsx
Last active July 25, 2021 19:55
Parcel + TypeScript + React
import * as React from 'react'
// routing, etc.
import { Reset } from '~/ui/shared/Reset'
export class App extends React.Component {
public render() {
return (
<div>
<title>Dashboard</title>
@Damovisa
Damovisa / azure-pipelines.yml
Created October 10, 2018 23:56
Azure Pipelines YML for ASP.NET Core
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
pool:
vmImage: 'Ubuntu 16.04'
variables:
buildConfiguration: 'Release'
@bradtraversy
bradtraversy / docker-help.md
Last active November 3, 2025 16:21
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@a7madgamal
a7madgamal / dark.md
Last active November 24, 2024 16:39
Dark mode for Slack on MacOS