Skip to content

Instantly share code, notes, and snippets.

View masaru-b-cl's full-sized avatar

TAKANO Sho / @masaru_b_cl masaru-b-cl

View GitHub Profile
@masaru-b-cl
masaru-b-cl / test.json
Last active May 30, 2024 06:06
アンスコをキーに持つJSONのテスト
{
"_hoge": "piyo"
}
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 25 2018 03:02:16)
macOS version
適用済パッチ: 1-1633
Compiled by [email protected]
Huge 版 with MacVim GUI. 機能の一覧 有効(+)/無効(-)
+acl +cmdline_info +extra_search +jumplist +mouse +odbeditor +signs +timers -X11
+arabic +comments +farsi +kaoriya +mouseshape +packages +smartindent +title -xfontset
+autocmd +conceal +file_in_path +keymap +mouse_dec +path_extra +startuptime +toolbar +xim
-autoservername +cryptv +find_in_path +lambda -mouse_gpm +perl/dyn +statusline +transparency -xpm
@masaru-b-cl
masaru-b-cl / pgco-alias.sh
Created May 22, 2019 08:25
pecoを使ってgit checkoutするやつ
alias pgco='git branch -a --sort=-authordate | cut -b 3- | perl -pe '\''s#^remotes/origin/###'\'' | perl -nlE '\''say if !$c{$_}++'\'' | grep -v -- "->" | peco | xargs git checkout'
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, serif;
background-color: white;
color: #24292e;
}
table {
width: auto;
border-collapse: collapse;
border-spacing: 0;
border-width: 1px;
@masaru-b-cl
masaru-b-cl / pvim.bat
Created April 3, 2018 05:52
pvim (ルートディレクトリ) で指定したディレクトリ配下のファイルをpecoで絞り込んでgvimで開くbatファイル
@echo off
set ROOT_DIR=.
if "%1" neq "" (
set ROOT_DIR=%1
if "%1" equ "~" (
set ROOT_DIR=%USERPROFILE%
)
)
@masaru-b-cl
masaru-b-cl / file0.txt
Last active August 31, 2017 07:26
Visual Studio Codeタスクのdotnetコマンド出力を文字化けしないようにする ref: http://qiita.com/masaru_b_cl/items/705b75d256b11cb82feb
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"windows": { // Windows固有の設定
"command": "cmd", // cmd.exeを実行
"args": [ "/C", "chcp 65001 && dotnet"] // /Cオプションで第二引数のコマンドを実行
}, // chcp 65001 の後に && で続けてdotnetを実行するよう指定
"tasks": [
<Query Kind="Statements" />
File.ReadAllLines(@"path\to\ppap.txt")
.Select(line => line.Length)
.ToList()
.ForEach(Console.WriteLine);
@masaru-b-cl
masaru-b-cl / type-swich-in-range.cs
Last active February 20, 2017 07:44
値の範囲で型スイッチによる分岐 in C#
int a = ...;
switch (a)
{
case int _ when a < 10: return "low";
case int _ when 90 < a: return "high";
default: return "middle";
}
@masaru-b-cl
masaru-b-cl / WordCountByLinq.linq
Last active February 16, 2017 05:36
"与えられた文字列中に含まれる単語の個数を単語ごとにカウントする"LINQ
<Query Kind="Expression" />
"I have a pen. I have a apple. oh!! Apple pen! I have a pen. I have a pineapple. oh!! Pineapple pen! Apple pen. Pineapplepen. Pen pineapple apple pen."
.Split(' ')
.Select(s => Regex.Replace(s, "[\\.!]", ""))
.Select(s => s.ToLower())
.ToLookup(w => w)
.Select(g => new { Word = g.Key, Count = g.Count()})
// Word | Count
class Program
{
static void Main()
{
var source = new [] {
new { Category = "A", Amount = 1000m },
new { Category = "B", Amount = 1000m },
new { Category = "B", Amount = 1000m },
new { Category = "C", Amount = 1000m },
new { Category = "C", Amount = 1000m },