Skip to content

Instantly share code, notes, and snippets.

@alanwei43
alanwei43 / app.html
Last active July 21, 2016 02:35
Angular Files Upload
<!DOCTYPE html>
<html>
<head>
<title>Angular Files Upload</title>
<meta charset="utf-8" />
<script src="http://cdn.bootcss.com/angular.js/1.3.18/angular.js"></script>
</head>
<body>
<div ng-app="FUApp">
<div ng-controller="BodyCtrl as main">
@alanwei43
alanwei43 / OpenWithSublimeText2.bat
Created July 25, 2016 02:53 — forked from mrchief/LICENSE.md
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@alanwei43
alanwei43 / Microsoft REST API Guidelines.md
Created July 29, 2016 01:14
Microsoft REST API Guidelines

Microsoft REST API Guidelines

Reference

Microsoft REST API Guidelines Working Group

| | | ---------------------------- | -------------------------------------- | ---------------------------------------- Dave Campbell (CTO C+E) | Rick Rashid (CTO ASG) | John Shewchuk (Technical Fellow, TED HQ) Mark Russinovich (CTO Azure) | Steve Lucco (Technical Fellow, DevDiv) | Murali Krishnaprasad (Azure App Plat) Rob Howard (ASG) | Peter Torr (OSG) | Chris Mullins (ASG)

@alanwei43
alanwei43 / linq2js.js
Created August 4, 2016 10:09
LINQ to JavaScript
//TODO
/**
* filter
* map
* skip
* take
* aggregate
* sum
* order
//TODO
/**
* filter
* map
* skip
* take
* aggregate
* sum
* order
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
public class GetSocket
{
private static Socket ConnectSocket(string server, int port)
{
using System;
using System.Collections;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using System.IO;
@alanwei43
alanwei43 / OpenWithSublimeText3.bat
Created July 9, 2018 01:48 — forked from jackielii/OpenWithSublimeText3.bat
Add "Open with Sublime Text 3" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@alanwei43
alanwei43 / GlobalErrorActionFilter.cs
Last active July 9, 2018 09:01
ASP.Net 全局异常处理
public class GlobalErrorActionFilter : IExceptionFilter
{
public void OnException(ExceptionContext filterContext)
{
Exception ex = filterContext.Exception;
filterContext.ExceptionHandled = true;
var response = filterContext.HttpContext.Response;
response.Clear();
response.StatusCode = 200;
@alanwei43
alanwei43 / GlobalWebApiExceptionFilter.cs
Created July 9, 2018 09:29
ASP.Net Web API 全局异常捕获
public class GlobalWebApiExceptionFilter : ExceptionFilterAttribute
{
public override void OnException(HttpActionExecutedContext context)
{
base.OnException(context);
if (context.Exception is NotImplementedException)
{
context.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.OK);
context.Response.Content = new System.Net.Http.StringContent("not implement");
}