Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladislav Stoyanov VladoMS

View GitHub Profile
@VladoMS
VladoMS / KeyValuePairExtension.cs
Created Aug 18, 2017 — forked from emoacht/KeyValuePairExtension.cs
Deconstruct extension method for KeyValuePair in C# 7
View KeyValuePairExtension.cs
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;
}
}
View ValidationGroup.vue
<template>
<div>
<slot></slot>
</div>
</template>
<script>
import Vue from 'vue'
export default {
@VladoMS
VladoMS / Web.config
Created Jun 21, 2017 — forked from suhrab/Web.config
IIS serve pre-compressed static gzip files
View Web.config
<?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 — forked from antoinemartin/fcgi.py
Django management command to run Django on Windows with IIS through FastCGI
View fcgi.py
# 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
View WebFormsBootstrapValidation.aspx
<%@ 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" />
View gist:70798edbf90538ee98587f482a6b499e
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
View gist:823effe68759724b5a99015232a7b077
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 Feb 6, 2017 — forked from rionmonster/IQueryableExtensions
Resolve the SQL being executed behind the scenes in Entity Framework Core
View IQueryableExtensions
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");
View CoreCompat.System.Drawing.cs
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)
{
View LowercaseDocumentFilter.cs
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)
{
You can’t perform that action at this time.