Skip to content

Instantly share code, notes, and snippets.

Vasili Puchko zihotki

Block or report user

Report or block zihotki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3881fe398f83dc2097c04f0233e56a9c
Install the Add the Microsoft.AspNet.HttpOverrides package
In your Configure() method add
app.UseOverrideHeaders(new OverrideHeaderMiddlewareOptions
{
ForwardedOptions = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto
});
@zihotki
zihotki / Lighter or Darker a Color.cs
Created Dec 17, 2017
.net C# make a color lighter or darker
View Lighter or Darker a Color.cs
/// <summary>
/// Creates color with corrected brightness.
/// </summary>
/// <param name="color">Color to correct.</param>
/// <param name="correctionFactor">The brightness correction factor. Must be between -1 and 1.
/// Negative values produce darker colors.</param>
/// <returns>
/// Corrected <see cref="Color"/> structure.
/// </returns>
public static Color ChangeColorBrightness(Color color, float correctionFactor)
@zihotki
zihotki / ngrxintro.md
Created Mar 15, 2017 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series
View ngrxintro.md

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@zihotki
zihotki / .bash_profile
Created Jun 4, 2016
My personal settings for git
View .bash_profile
alias g=git
alias ls='/bin/ls -F --color=tty --show-control-chars'
alias ga='gitk --all&'
alias gs='git st'
@zihotki
zihotki / RecursiveStack.cs
Created May 31, 2016
Stack implementation using recursive links
View RecursiveStack.cs
using System;
public class Program
{
public static void Main()
{
var stack = new Stack();
stack.Push(5);
stack.Push(4);
stack.Push(3);
@zihotki
zihotki / LogRequestModule.cs
Created Apr 6, 2016
Autofac module to write to debug output component resolve and activation messages
View LogRequestModule.cs
public class LogRequestModule : Module
{
public int depth = 0;
protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry,
IComponentRegistration registration)
{
registration.Preparing += RegistrationOnPreparing;
registration.Activating += RegistrationOnActivating;
//registration.Activated += RegistrationOnActivated;
@zihotki
zihotki / Export Table to Excel
Created Oct 10, 2013
Exporting html table to excel file
View Export Table to Excel
<script type="text/javascript">
function generate_excel(tableid) {
var table= document.getElementById(tableid);
var html = table.outerHTML;
window.open('data:application/vnd.ms-excel;base64,' + base64_encode(html));
}
function base64_encode (data) {
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
View RenderPrintViewToString.cs
/*
* Original Sample: http://craftycodeblog.com/2010/05/15/asp-net-mvc-render-partial-view-to-string/
*/
public class HomeController : Controller
{
public ActionResult Index()
{
string MyModelData = "";
@zihotki
zihotki / MenuLinkExtension.cs
Created Sep 14, 2012
asp.net mvc MenuLink extension
View MenuLinkExtension.cs
public static MvcHtmlString MenuLink(
this HtmlHelper helper,
string text, string action, string controller)
{
var routeData = helper.ViewContext.RouteData.Values;
var currentController = routeData["controller"];
var currentAction = routeData["action"];
if(String.Equals(action, currentAction as string,
StringComparison.OrdinalIgnoreCase)
You can’t perform that action at this time.