This file contains 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 static class Extensions | |
{ | |
public static void AddRange<T>(this ObservableCollection<T> oc, IEnumerable<T> collection) | |
{ | |
if (collection == null) | |
{ | |
throw new ArgumentNullException("collection"); | |
} | |
collection.ToList().ForEach( oc.Add); | |
} |
This file contains 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 static string InsertNewLine(string source, int len = 76) | |
{ | |
var sb = new StringBuilder(source.Length + (int)(source.Length / len) + 1); | |
var start = 0; | |
while ((start + len) < source.Length) | |
{ | |
sb.Append(source.Substring(start, len)); | |
sb.Append(Environment.NewLine); | |
start += len; | |
} |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>author</key> | |
<string>Chris Thomas</string> | |
<key>name</key> | |
<string>Mac Classic</string> | |
<key>settings</key> | |
<array> |
This file contains 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
/*++ BUILD Version: 0073 Increment this if a change has global effects | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Module Name: | |
winnt.h | |
Abstract: |
This file contains 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
// https://gist.github.com/ichengzi/fa90fede6c7ce91bbb083ea2e5466a38 | |
const entry = { | |
a: { | |
b: { | |
c: { | |
dd: "abcdd" | |
} | |
}, | |
d: { |
This file contains 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
// https://www.bilibili.com/video/BV1BL411K7Dy | |
const arr = [ | |
[1, 2, 2], | |
[3, 4, 5, 5], | |
[6, 7, 8, 9, | |
[11, 12, | |
[12, 12, | |
[13] | |
] |
This file contains 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 static class Base64Url | |
{ | |
public static string Encode(byte[] arg) | |
{ | |
if (arg == null) | |
{ | |
throw new ArgumentNullException("arg"); | |
} | |
var s = Convert.ToBase64String(arg); |
This file contains 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 RandomIdCardUtil | |
{ | |
[Test] | |
public void generate() | |
{ | |
for (int i = 0; i < 100; i++) | |
{ | |
var cusId = RandomIDCardGenerator.GetRandomCard(14, 14); | |
Console.WriteLine($"{cusId.Substring(0, 6)}" + | |
$"-{cusId.Substring(6, 4)}" + |
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace demo | |
{ | |
public class MimeType | |
{ | |
public static string GetOrDefault(string fileExtension, string defaultMime) |