Skip to content

Instantly share code, notes, and snippets.

View vmandic's full-sized avatar
🤠
chillin'

Vedran Mandić vmandic

🤠
chillin'
View GitHub Profile
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@binki
binki / AsyncDisposal.cs
Last active April 10, 2019 20:04 — forked from thomaslevesque/AsyncDisposal.cs
Async disposal
using System;
using System.Threading.Tasks;
class Program
{
static void Main() => new Program().Run().Wait();
async Task Run()
{
Console.WriteLine("Before Using");
await Async.Using(new Test(), t =>
@regisdiogo
regisdiogo / Startup.cs
Last active July 26, 2025 11:17
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;
});
}

An EF Core / OData - Generic Repository 🛠 😵

This library offers an implementation of the Generic Repository Pattern for Microsoft's Entity Framework Core 2.0 ORM supporting the use of OData v4 querying service protocol.

The OData part of the library offers an additional Repository implementation named ODataEfRepository with its complementing interface type IODataEfRepository. The OData Repository exposes several methods that allow querying an IQueryable<T> with OData's query options where the queryable can be produced out of EF's DbSet<T> or any other valid IQueryable<T>. This way you can pre/post filter/select/expand EF queryable sources using OData syntax.

Beta dependency caution 💣

The library currently uses the latest Microsoft.AspnetCore.OData (7.0.0-beta2) to provide OData services and it might be buggy as it is not a stable offical release.

@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](
@vmandic
vmandic / cloudSettings
Last active June 23, 2020 12:25
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-06-23T12:25:19.840Z","extensionVersion":"v3.4.3"}
@hlaueriksson
hlaueriksson / Examples.cs
Last active November 12, 2023 21:19
PuppeteerSharp Documentation
using System;
using System.Threading.Tasks;
using NUnit.Framework;
namespace PuppeteerSharp.Contrib.Sample
{
public class Examples
{
async Task<IBrowser> Browser()
{
@vbilopav
vbilopav / pubsub.js
Last active February 19, 2019 14:26
/*
*** Publish/Subscribe global events functions - implementation of pubsub pattern for loose coupled components ***
Usage:
* Publish global application event:
publish("unique event name / category / subcategory", arg1, arg2, arg3);
or
@jeremyabbott
jeremyabbott / removeDotnetSdksRuntimes.sh
Last active April 28, 2019 08:19
Remove old .NET Core versions
# dotnet --list-sdks # output looks like
# 2.1.500 [/usr/local/share/dotnet/sdk]
# awk '{print $2"/"$1}' # takes each line from stdin and prints out the 2nd column then "/" then the first column
# this gives us [/usr/local/share/dotnet/sdk]/2.1.500
# sed 's/\]//' # replaces the first ']'. ']' has to be escaped with \
# sed 's/\[//' # replaces the first '['. '[' has to be escaped with \
# grep -Ev '2\.2\.102' # matches on 2.2.102 which was the latest SDK installed
# -E # enables extended regular expression syntax
# -v # inverts the match. So return anything that doesn't match
# xargs # allows us to pass standard in as an argument to rm -rf
@davidfowl
davidfowl / Program.cs
Last active June 29, 2024 18:09
A minimal fully asynchronous C# ASP.NET Core 3.0 application with routing (learn more about ASP.NET Core here https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.0)
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>