Skip to content

Instantly share code, notes, and snippets.

View VladoMS's full-sized avatar

Vladislav Stoyanov VladoMS

View GitHub Profile
@VladoMS
VladoMS / KeyValuePairExtension.cs
Created August 18, 2017 19:17 — forked from emoacht/KeyValuePairExtension.cs
Deconstruct extension method for KeyValuePair in C# 7
public static class KeyValuePairExtension
{
public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> source, out TKey Key, out TValue Value)
{
Key = source.Key;
Value = source.Value;
}
}
<template>
<div>
<slot></slot>
</div>
</template>
<script>
import Vue from 'vue'
export default {
@VladoMS
VladoMS / Web.config
Created June 21, 2017 12:48 — forked from suhrab/Web.config
IIS serve pre-compressed static gzip files
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseExpires" httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" />
<mimeMap fileExtension=".js.gz" mimeType="application/javascript" />
</staticContent>
</system.webServer>
<location path="gz">
<system.webServer>
@VladoMS
VladoMS / fcgi.py
Created May 4, 2017 13:01 — forked from antoinemartin/fcgi.py
Django management command to run Django on Windows with IIS through FastCGI
# encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 Ruslan Keba <ruslan@helicontech.com>
# Copyright (c) 2012 Antoine Martin <antoine@openance.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@VladoMS
VladoMS / WebFormsBootstrapValidation.aspx
Created February 16, 2017 08:58 — forked from meziantou/WebFormsBootstrapValidation.aspx
ASP.NET WebForms Validators & Bootstrap
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASP.NET WebForms Validators & Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css" />
@VladoMS
VladoMS / gist:70798edbf90538ee98587f482a6b499e
Created February 12, 2017 20:03 — forked from jeffrafter/gist:1328625
Local nginx proxy to rails s
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
class Query
undef select
def method_missing(id, &block)
if block
instance_variable_set("@#{id}", block)
else
instance_variable_get("@#{id}")
end
end
end
@VladoMS
VladoMS / IQueryableExtensions
Created February 6, 2017 10:05 — forked from rionmonster/IQueryableExtensions
Resolve the SQL being executed behind the scenes in Entity Framework Core
public class IQueryableExtensions
{
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler");
private static readonly PropertyInfo NodeTypeProviderField = QueryCompilerTypeInfo.DeclaredProperties.Single(x => x.Name == "NodeTypeProvider");
private static readonly MethodInfo CreateQueryParserMethod = QueryCompilerTypeInfo.DeclaredMethods.First(x => x.Name == "CreateQueryParser");
using System.Drawing;
const int size = 150;
const int quality = 75;
using (var image = new Bitmap(System.Drawing.Image.FromFile(inputPath)))
{
int width, height;
if (image.Width > image.Height)
{
using System.Collections.Generic;
using System.Web.Http.Description;
using Swashbuckle.Swagger;
namespace BoundedContext.Web.Swagger
{
public class LowercaseDocumentFilter : IDocumentFilter
{
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
{