Skip to content

Instantly share code, notes, and snippets.

View abhishekbhalani's full-sized avatar
🎄
working on latest framework...

Abhishek B. abhishekbhalani

🎄
working on latest framework...
View GitHub Profile
// Filter
public class CorsFilter : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
var response = filterContext.RequestContext.HttpContext.Response;
// Add header to response
response.AddHeader("Access-Control-Allow-Origin", "*");
@Teivaz
Teivaz / gdrive.js
Last active September 1, 2023 18:03
Google Drive API V3 simple but working use case.
'use strict';
const driveUploadPath = 'https://www.googleapis.com/upload/drive/v3/files';
// 'id' is driveId - unique file id on google drive
// 'version' is driveVersion - version of file on google drive
// 'name' name of the file on google drive
// 'appProperties' keep the custom `ifid` field
const fileFields = 'id,version,name,appProperties';
@guitarrapc
guitarrapc / ELBv2Sample.cs
Last active March 11, 2022 12:32
Amazon Application Elastic Load Balancing (ELB v2) C# Sample with HTTPS -> HTTP (HTTPS by ACM Certificate)
using Amazon.CertificateManager
using Amazon.EC2
using Amazon.ElasticLoadBalancingV2
using Amazon.ElasticLoadBalancingV2.Model
using System.Net.Http
using System.Threading.Tasks
using System.Windows.Forms.DataVisualization.Charting
public class Program
{
@regisdiogo
regisdiogo / Startup.cs
Last active May 5, 2025 09:51
ASP.NET Core - Json serializer settings Enum as string and ignore null values
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
});
}
@DalSoft
DalSoft / DalSoftDbContext.cs
Last active March 12, 2018 07:41
Entity Framework Core Migrations and Seeding
using System;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;
namespace DalSoft.Data
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
namespace Blog.TokenAuthGettingStarted
{
public partial class Startup
@sohan5005
sohan5005 / markup.html
Created January 30, 2017 06:47
Easy setup for shuffle.js with filter system
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Shuffle.js</title>
<style>
body {
max-width: 1170px;
margin: auto;
}
@jbritton
jbritton / graphql-cheat-sheet.md
Last active September 24, 2024 21:25
GraphQL Cheat Sheet

GraphQL Cheat Sheet

Overview

  • An alternative approach to RESTful APIs
  • Clients issue queries/mutations to read and update data
  • Clients can fetch only the entity fields that are required
  • GraphQL query syntax can express complex entity relations => nested objects
  • Mitigates the explosion of RESTful endpoints in scenarios where many different representations of an entity are needed
  • Graphiql is a query execution UI, also provides good documentation
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@arcadiogarcia
arcadiogarcia / Web.config
Created June 28, 2017 11:35
Web.config for allowing .json files in IIS (for Azure Web Apps)
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>