Skip to content

Instantly share code, notes, and snippets.

@Wind4
Wind4 / Wintellect.cs
Last active December 31, 2015 00:19
Code time
/******************************************************************************
Module: Wintellect.cs
Notices: Copyright (c) 2008-2009 Jeffrey Richter
******************************************************************************/
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.Win32.SafeHandles;
@Wind4
Wind4 / MarshalExtend.cs
Created December 11, 2013 07:35
Reading binary data structure filled.
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Common
{
/// <summary>
/// 一种通用的将byte数组流转换为对象的方法
/// </summary>
/// <see cref="http://www.cnblogs.com/TianFang/archive/2012/10/06/2712987.html"/>
@Wind4
Wind4 / BubbleSort.cs
Created December 11, 2013 07:37
泛型冒泡排序
using System;
using System.Collections.Generic;
namespace Study
{
public class Alogrithm
{
/// <summary>
/// 交换数组中2个元素的位置
/// </summary>
@Wind4
Wind4 / vwdecode.php
Created December 11, 2013 08:05
威盾PHP加密专家解密算法 By:Neeao
<?php
/***********************************
* 威盾PHP加密专家解密算法 By:Neeao
* http://Neeao.com
* 2009-09-10
***********************************/
$filename="index.php";//要解密的文件
$lines = file($filename);//0,1,2行
@Wind4
Wind4 / lambda.cs
Created December 11, 2013 08:12
Lambda 递归
using System;
namespace Alogrithm
{
public class Recursion
{
public static Func<T, TResult> Fix<T, TResult>(Func<Func<T, TResult>, Func<T, TResult>> f)
{
return n => f(Fix(f))(n);
}
@Wind4
Wind4 / ShutDown.cs
Created December 11, 2013 08:15
C# 调用系统关机、重启、注销的类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WorkHelper
{
class ShutDown
{
@Wind4
Wind4 / pkg_Pagination.sql
Created December 11, 2013 08:18
Oracle 分頁存儲過程
CREATE OR REPLACE PACKAGE pkg_Pagination IS
TYPE type_cur IS REF Cursor; --定义数据返回游标
PROCEDURE Pagination (
querySQL in varchar2, --SQL查询语句
pageNum in number, --当前页数
pageSize in number, --单页数量
totalRecord out number, --返回总记录数
v_cur out type_cur --返回数据游标
);
END pkg_Pagination;
@Wind4
Wind4 / char.cs
Last active January 1, 2016 00:29
byte[] 转 string
/// <summary>
/// 十六进制映射表
/// </summary>
private static readonly Char[] _lookup = new Char[]
{
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'A', 'B',
'C', 'D', 'E', 'F'
};
@Wind4
Wind4 / ParameterRebinder.cs
Last active January 3, 2016 23:19
PredicateBuilder
using System;
using System.Collections.Generic;
using System.Linq;
namespace System.Linq.Expressions
{
public sealed class ParameterRebinder : ExpressionVisitor
{
private readonly Dictionary<ParameterExpression, ParameterExpression> _map;
@Wind4
Wind4 / string.cs
Last active August 29, 2015 14:01
/// <summary>
/// 转全角(SBC case)
/// </summary>
/// <param name="input">任意字符串</param>
/// <returns>全角字符串</returns>
public static string ToSBC(this string input)
{
char[] c = input.ToCharArray();
for (int i = 0; i < c.Length; i++)
{