This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserModelBinder : IModelBinder | |
{ | |
public Func<UserDataService> UserData { get; set; } | |
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
Guid UserID = (Guid)Membership.GetUser().ProviderUserKey; | |
User u = UserData().GetUser(UserID); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RouteConfig | |
{ | |
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |
routes.IgnoreRoute("{*vti_inf}", new { vti_inf = @"(.*/)?_vti_inf.html(/.*)?" }); | |
routes.IgnoreRoute("{*vti_rpc}", new { vti_rpc = @"(.*/)?_vti_rpc(/.*)?" }); | |
routes.IgnoreRoute("{*allphp}", new { allphp = @".*\.php(/.*)?" }); | |
routes.IgnoreRoute("{*allcgi}", new { allcgi = @".*\.cgi(/.*)?" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset remoteAddress = getHttpRequestData().headers["CF-Connecting-IP"] > | |
<cfif remoteAddress eq ''> | |
<cfset remoteAddress = getHttpRequestData().headers["X-Forwarded-For"] > | |
</cfif> | |
<cfif remoteAddress eq ''> | |
<cfset remoteAddress = cgi.REMOTE_ADDR > | |
</cfif> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AntiForgeryToken automatically adds x-Frame-Options SAMEORIGIN for each token | |
// resulting in | |
// X-Frame-Options SAMEORIGIN, SAMEORIGIN, SAMEORIGIN, SAMEORIGIN, SAMEORIGIN, SAMEORIGIN, SAMEORIGIN.... | |
// This happens when there is update form inside the list and each update form have Antiforgerytoken | |
// If hosted on CloudFlare, this will produce Error 520, if header size becomes larger than 32KB | |
// Adding following will fix the issue. | |
// Global.ascx.cs | |
protected void Application_Start() | |
{ | |
AntiForgeryConfig.SuppressXFrameOptionsHeader = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The nano editor is designed to emulate the functionality and ease-of-use | |
of the UW Pico text editor. There are four main sections of the editor. | |
The top line shows the program version, the current filename being | |
edited, and whether or not the file has been modified. Next is the main | |
editor window showing the file being edited. The status line is the | |
third line from the bottom and shows important messages. The bottom two | |
lines show the most commonly used shortcuts in the editor. | |
The notation for shortcuts is as follows: Control-key sequences are | |
notated with a caret (^) symbol and can be entered either by using the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$files = Get-ChildItem "app*.config" -Recurse | |
$find = 'some-string-to-find' | |
$replace = 'some-string-to-replace-with' | |
Get-ChildItem $files -Recurse | | |
select -ExpandProperty fullname | | |
foreach { | |
If(Select-String -Path $_ -SimpleMatch $find -quiet){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Script to remove project_readme.html from newly created asp.net web application project | |
/// using Package Manager Console in visual studio. | |
// To Open nuget_profile.ps1 from package manager console | |
// notepad $profile | |
// In NuGet_profile.ps1 | |
set-alias rpr Remove-Project-Readme | |
Function Remove-Project-ReadMe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading.Tasks; | |
using Amazon.S3; | |
using Amazon.S3.Model; | |
using Amazon.S3.Transfer; | |
namespace AWSDemo.Models | |
{ | |
public class S3Uploader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from https://forum.sublimetext.com/t/windows-st3-python-3-unicode-output/15261/4 | |
import sys | |
from io import TextIOWrapper | |
sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav> | |
<ul class="nav nav-pills"> | |
<li class="nav-item"> | |
<router-link to="/" class="nav-link" exact-active-class="active" | |
>Home</router-link | |
> | |
</li> | |
<li class="nav-item"> | |
<router-link | |
class="nav-link" |
OlderNewer