Skip to content

Instantly share code, notes, and snippets.

C#编码规范

概述

规范制定原则

  • 方便代码的交流和维护。
  • 不影响编码的效率,不与大众习惯冲突。
  • 使代码更美观、阅读更方便。
  • 使代码的逻辑更清晰、更易于理解。
@lcomplete
lcomplete / app.config
Created June 20, 2020 03:25 — forked from grenade/app.config
Emit log4net entries to logstash over UDP in near-realtime
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
@lcomplete
lcomplete / mysql_dim_date.sql
Created June 28, 2020 07:43
mysql创建日期维度表
drop table if exists dim_date;
CREATE TABLE dim_date
(
date_key int NOT NULL,
full_date date NULL,
date_name char(11) NOT NULL,
date_name_us char(11) NOT NULL,
date_name_eu char(11) NOT NULL,
day_of_week tinyint NOT NULL,
day_name_of_week char(10) NOT NULL,
@lcomplete
lcomplete / crawl_music.py
Created June 28, 2020 07:52
python抓取音乐(早期代码,已经无法使用)
#coding=utf-8
import urllib,urllib2,re,os,json,gevent,traceback
from BeautifulSoup import BeautifulSoup
from gevent import monkey
monkey.patch_all()
rootUrl='http://music.baidu.com'
artistId=2825 #想批量下载并归类你喜欢的歌手的所有专辑?那就把这里替换成该歌手在百度音乐的Id吧,例如:http://music.baidu.com/artist/2825
@lcomplete
lcomplete / crawl_image.rb
Created June 28, 2020 07:53
ruby抓取图片(早期代码,已经无法使用)
#encoding: utf-8
require 'net/http'
require 'open-uri'
require 'nokogiri' # 用于解析html的模块
# sudo apt-get install libxslt-dev libxml2-dev
# sudo gem install nokogiri
require 'pathname'
class JanDanSpider
@lcomplete
lcomplete / 爱因斯坦斑马难题.md
Last active June 28, 2020 07:56
使用prolog解决爱因斯坦斑马难题

爱因斯坦逻辑难题

5个不同国家且工作各不相同的人分别住在一条街上的5所房子里,每所房子的颜色不同,每个人都有自己养的不同宠物,喜欢喝不同的饮料。根据以下提示,你能告诉我哪所房子里的人养斑马,哪所房子里的人喜欢喝矿泉水吗?

  1. 英国人住在红色的房子里
  2. 西班牙人养了一条狗
  3. 日本人是一个油漆工
  4. 意大利人喜欢喝茶
  5. 挪威人住在左边的第一个房子里
  6. 绿房子在白房子的右边
@lcomplete
lcomplete / Count lines in Git repo
Created July 10, 2020 14:29 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@lcomplete
lcomplete / 数据库中搜索字符串.sql
Created August 26, 2020 12:28
Sql Server 数据库中搜索字符串
USE DATABASE_NAME
DECLARE @SearchStr nvarchar(100) = 'SEARCH_TEXT'
DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
USE db
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(600),@TableRowCount int,@ColumnKey nvarchar(128),@DbName nvarchar(50);
SET @TableName = ''
WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = '';
@lcomplete
lcomplete / gist:dffeffeff313ce3fa9298013a6f48cbf
Created July 7, 2021 10:12 — forked from handrus/gist:8835872
Faster git clone for large repositories
git clone --depth 1 https://github.com/CocoaPods/Specs