Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Diagnostics;
using System.Linq;
public interface IFoo
{
// NOTICE: without "params" keyword.
void DoIt(object[] args);
}
@jsakamoto
jsakamoto / Invoke-LocalAzFunc.ps1
Last active December 8, 2017 12:50
Invoke-LocalAzFunc.ps1
[CmdletBinding()]
Param(
[int]$Port = 7071
)
DynamicParam {
$sdkOutFile = Get-ChildItem functionsSdk.out -Recurse | Sort-Object -Property LastWriteTimeUtc -Descending | Select-Object -First 1
if ($sdkOutFile -eq $null) {
Write-Host "Couldn't find `"functionsSdk.out`" file." -ForegroundColor Yellow
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
Console.Clear();
Console.WriteLine($"Enter digit numbers ({int.MinValue}~{int.MaxValue}).");
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
class 牛めし
{
public string 大きさ { get; set; }
public int カロリー { get; set; }
@jsakamoto
jsakamoto / allow.ps1
Created January 26, 2017 06:51
Create/Delete Azure Database server firewall rule by Microsoft Azure CLI 2.0 ("az" command)
$serverName = "<server name>"
$resourceGroupName = "<resource group name>"
$ruleName = "<rule name>"
$globalIPAddress = curl.exe -s http://inet-ip.info
echo "Global IP Address of this site: $globalIPAddress"
az sql server firewall create --firewall-rule-name $ruleName --server-name $serverName -g $resourceGroupName --start-ip-address $globalIPAddress --end-ip-address $globalIPAddress > $null
az sql server firewall list --server-name $serverName -g $resourceGroupName -o table
@jsakamoto
jsakamoto / Script1.fsx
Created November 10, 2016 23:04
Learn F# - mastering “Seq.map” – decode to ASCII art
let code = "f8f8f8f8f7b2f8f63181f8f5c1318131f8f401318101f8f3c10131810131f8f202318102f8f1c10231810231f803718103f7c10211f1e10331f6810271f28103f5e10211f1b1f1e10331f40371c131f28103f3c10211f10131f2e10331f2810271e10131f38103f1e103f1810131f3c10371f1810211e10131f3810211f2e103f18131f2e10331f3810231e131f28103f4e103f1b1f1e10371f5810231f2810211f6e103f1e10331f7810231810211f8e10231810271f8f1810131810111f8f2e10131810131f8f381318111f8f4c1318171f8f53191f8f7b1f8f8f8f8f07"
let decodeIt (code:string) =
let data =
[0..(code.Length/2)-1]
|> Seq.map (fun n -> code.Substring(n*2, 2))
|> Seq.map (fun s -> new String(s.[0], Convert.ToInt32(string s.[1], 16)))
|> Seq.toArray |> (fun a -> String.Join ("", a))
@jsakamoto
jsakamoto / 01.note.md
Last active October 27, 2016 13:59
Jasmine による TypeScript/JavaScript 単体テストを実行する環境を作る - Grunt 編

注意 - 本記事の内容は古いです。karma をテストランナーに採用した、「Jasmine による TypeScript/JavaScript 単体テストを実行する環境を作る - karma 編」の採用をご検討ください。

基本ステップ

OS 環境の整備

  1. node.js をインストールしておく (Windows ならここからインストーラをダウンロード)
  2. > npm istall -g grunt-cli で、システムグローバルに grunt-cli をインストール

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

@jsakamoto
jsakamoto / .gitignore
Last active September 2, 2016 13:01
オレの gulp
node_modules
@jsakamoto
jsakamoto / RestoreContextMenuZip.bat
Last active July 27, 2016 05:46
エクスプローラの「送る」の中に、「圧縮フォルダー」を復活させる、及び、Zipファイルの右クリックメニューを復活させる
@echo off
rem [注意] 日本語含んでいるので、SHIFT-JIS エンコードでこのバッチファイルを作成すること。
openfiles > NUL 2>&1
if NOT %ERRORLEVEL% EQU 0 goto NotAdmin
reg add HKCR\.zip /f /ve /d "CompressedFolder" > NUL
reg add HKCR\.zip /f /v "Content Type" /t REG_SZ /d "application/x-zip-compressed" > NUL
reg add HKCR\.zip /f /v "DontCompressInPackage" /t REG_SZ /d "" > NUL
reg add HKCR\.zip /f /v "PerceivedType" /t REG_SZ /d "compressed" > NUL
reg add HKCR\.zip\OpenWithProgids /f /v "CompressedFolder" /t REG_SZ /d "" > NUL
@jsakamoto
jsakamoto / pre-build.bat
Created July 20, 2016 14:09
pre-build script for create "custom.appSettings.config"
if exist "$(ProjectDir)custom.appSettings.config" goto SKIP
echo ^<?xml version="1.0" encoding="utf-8" ?^> > "$(ProjectDir)custom.appSettings.config"
echo ^<appSettings^> >> "$(ProjectDir)custom.appSettings.config"
echo ^<add key="(key)" value="(value)"/^> >> "$(ProjectDir)custom.appSettings.config"
echo ^</appSettings^> >> "$(ProjectDir)custom.appSettings.config"
:SKIP