Skip to content

Instantly share code, notes, and snippets.

public class Friend
{
[JsonPropertyName("n")]
public string Name { get; set; }
[JsonPropertyName("s")]
public int ShoeSize { get; set; }
}
@code
{
public class Friend
{
public string Name { get; set; }
public int ShoeSize { get; set; }
}
private async Task GetFriends()
{
var db = new Dexie("friend_database");
db.version(1).stores({
friends: 'name,shoeSize'
});
window.putFriend = (friend) =>
db.friends.put(friend);
window.getFriends = () =>
db.friends.toArray();
<script src="_framework/blazor.webassembly.js"></script>
<script src="https://unpkg.com/dexie@latest/dist/dexie.js"></script>
<script src="js/db.js"></script>
publish/** binary
{
"routes": [
{
"route": "/*",
"serve": "/index.html",
"statusCode": 200
}
]
}
var path = @"日本語の姓.txt";
var names = File.ReadAllLines(path).Where(x => x.Trim() != "").ToList();
var filteredNames = names
.Select(x => Regex.Replace(x, @"\(.+\)", "").Replace(" ", ""))
.Where(x => x.All(y => charHashSet.Contains(y)))
.ToList();
Console.WriteLine($"{filteredNames.Count}件");
Console.WriteLine(string.Join(",", filteredNames));
@jz5
jz5 / Chars.cs
Last active April 12, 2020 15:05
static void Main(string[] args)
{
var lines = File.ReadAllLines(@"ナンバープレート一覧.csv", Encoding.UTF8).ToList();
var places = lines.Skip(1).Select(x => x.Split(',')[2]);
var chars = new List<char>();
var charHashSet = new HashSet<char>();
foreach (var name in places)
{
chars.AddRange(name.ToCharArray());
@jz5
jz5 / Program.cs
Last active April 12, 2020 13:55
class Program
{
static void Main(string[] args)
{
var titles = GetTitles("Category:日本語の姓");
File.WriteAllText("日本語の姓.txt", string.Join("\r\n", titles), Encoding.UTF8);
}
private static List<string> GetTitles(string cmtitle)
{
var apng = new APNG("a.png");
if (apng.IsSimplePNG)
PngImage.Source = BitmapFrame.Create(
apng.DefaultImage.GetStream(), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
else
apng.ToAnimation().CreateStoryboardFor(PngImage).Begin(PngImage);