Skip to content

Instantly share code, notes, and snippets.

View App.razor
<p>
<div>
<input type="text" @bind="Text1" />
Text1: [@Text1]
</div>
</p>
<p>
<div>
<input type="text" @bind="Text2" @bind:event="oninput" />
@jsakamoto
jsakamoto / Person.cs
Last active Jul 26, 2020
Study of System.Text.Json
View Person.cs
namespace StudyOfSystemTextJson
{
public class Person
{
public string Name { get; }
public int Age { get; }
public Person(string name, int age)
{
@jsakamoto
jsakamoto / - README -.md
Last active Jul 25, 2020
Wrapper class for System.Text.Encoding object to add missing "BodyName" and "HeaderName" property.
View - README -.md

What's this?

This is C# code for .NET Core application.

This code provides BodyNamePatchedEncoding Encoding class for wrapping other encoding object to avoid raising "System.NotSupportedException : No data is available for encoding ????".

This exception is sometimes raised when using the encoding object that is in System.Text.Encoding.CodePages NuGet package, because those encoding classes don't implement "BodyName" and "HeaderName" property.

@jsakamoto
jsakamoto / App.razor
Created Dec 18, 2019
Blazor で、行が動的に増減する入力フォームを実装してみる
View App.razor
<div>
@foreach (var person in this.People)
{
<div @key="person.Id">
<input type="text" placeholder="名前" @bind="person.Name" />
<input type="number" placeholder="年齢" @bind="person.Age" />
<button @onclick="()=>OnClickRemove(person)">削除</button>
</div>
}
</div>
@jsakamoto
jsakamoto / sample.cs
Created Sep 27, 2012
return result as PartialViewResult, and translation from PartialViewResult to string.
View sample.cs
public ViewResultBase Render(HtmlHelper helper)
{
return new PartialViewResult
{
ViewName = "AnyPartialViewResult",
ViewData = new ViewDataDictionary(helper.ViewData)
{
Model = new AnyPartialViewModel()
},
TempData = helper.ViewContext.TempData
@jsakamoto
jsakamoto / counter.component.ts
Created Jan 26, 2019
Angular + SignalR な Web アプリで、HubConnection.invoke() 時の変更検知発動を抑止する
View counter.component.ts
import { Component, NgZone, OnInit, OnDestroy } from '@angular/core';
import { HubConnectionBuilder, HubConnection, LogLevel, JsonHubProtocol } from '@aspnet/signalr';
import { Subject } from 'rxjs/Subject';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'app-counter-component',
templateUrl: './counter.component.html'
})
export class CounterComponent implements OnInit, OnDestroy {
@jsakamoto
jsakamoto / _README.md
Last active Nov 18, 2018
Jasmine による TypeScript/JavaScript 単体テストを実行する環境を作る - karma 編
View _README.md

基本ステップ

OS 環境の整備

  1. node.js をインストールしておく (Windows ならここからインストーラをダウンロード)

プロジェクトごとの環境構築

  1. 作業フォルダ(プロジェクトフォルダ)に移動。
  2. > npm init で作業場所を準備、package.json を生成。
@jsakamoto
jsakamoto / README.md
Last active Jul 9, 2018
How to enable MFA on your AWS account
View README.md

How to enable MFA on your AWS account

@jsakamoto
jsakamoto / Test-MixedContent.ps1
Created Jun 13, 2018 — forked from stknohg/Test-MixedContent.ps1
Selenium WebDriver(Chrome)を使った簡単なMixed Contentのチェック例
View Test-MixedContent.ps1
# パスチェック
# カレントディレクトリにWebDriver.dllとchromedriver.exeがある前提
if ( -not (Test-Path -LiteralPath '.\WebDriver.dll')) {
Write-Error 'WebDriver.dllがありません。'
return
}
if ( -not (Test-Path -LiteralPath '.\chromedriver.exe')) {
Write-Error 'chromedriver.exeがありません。'
return
}
View Program.cs
using System;
using System.Diagnostics;
using System.Linq;
public interface IFoo
{
// NOTICE: without "params" keyword.
void DoIt(object[] args);
}