Skip to content

Instantly share code, notes, and snippets.

View Grabacr07's full-sized avatar
🏠
Working from home

Manato Kameya Grabacr07

🏠
Working from home
View GitHub Profile
@Grabacr07
Grabacr07 / XmlSerializableDictionary`2.cs
Last active December 30, 2015 13:59
昔何かを参考にして作ったやつ。 設定ファイル用に、System.Xml.Serialization.XmlSerializer で保存/復元するためのもの。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
namespace Grabacr07.Utilities.Data.Xml
{
/// <summary>
A「煙草吸ってもよろしいですか?」
B「どうぞ。ところで一日に何本くらいお吸いに?」
A「ふた箱くらいですね」
B「喫煙年数はどれくらいですか?
A「30 年くらいですね」
B「なるほど。あそこにベンツが停まってますね」
A「停まってますね」
B「もしあなたが煙草を吸わなければ」
C「ちくわ大明神 (@kurosawa0626)」
B「あれくらい買えたんですよ」
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;
@Grabacr07
Grabacr07 / save.cs
Last active May 10, 2016 11:11
Windows Spotlight の画像を縦横仕分けして保存するやつ (LINQPad 向け)
void Main()
{
var sourcePath = Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets");
var destinationPath = @"*** Your wallpaper folder ***";
var sourceDirectory = new DirectoryInfo(sourcePath);
if (!sourceDirectory.Exists)
{
$"Directory not found.".Dump();
return;
@Grabacr07
Grabacr07 / Ufcpp.cs
Created December 14, 2016 09:50
.NET 4.6 プロジェクトだとエラーになるけど、PCL だとエラーにならない構造体
using System;
namespace Ufcpp
{
public struct Ufcpp
{
private readonly DateTimeOffset _dateTime;
public Ufcpp(DateTimeOffset dateTime)
{
@Grabacr07
Grabacr07 / Counter.cs
Last active August 28, 2018 07:10
LINQPad で KanColleViewer のダウンロード数かぞえるやつ (要 Json.NET)
using (var client = new HttpClient())
{
var url = new Uri("https://api.github.com/repos/Grabacr07/KanColleViewer/releases");
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Grabacr07-LINQPad", "1.0"));
var result = Util.Cache(() => client.GetAsync(url).Result);
var json = await result.Content.ReadAsStringAsync();
var start = new DateTime(2015, 02, 01);
var end = start.AddYears(1).AddMilliseconds(-1.0);
@Grabacr07
Grabacr07 / DragAndDropSample.cs
Last active November 30, 2018 23:02
@hivesbee 誕生日おめでとう
public partial class MainWindow : Window
{
/// <summary>
/// D&D の軌跡のコレクションのコレクション。
/// </summary>
private readonly List<List<Point>> points = new List<List<Point>>();
public MainWindow()
{
InitializeComponent();
@Grabacr07
Grabacr07 / MainWindow.xaml
Last active November 17, 2021 20:39
WPF の Thumb コントロールで Photoshop のナビゲーターを再現するやつ
<Window x:Class="ThumbsScrollViewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Width="1200"
Height="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />