This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.parsing.combinator._ | |
// パーサ | |
class PostalCodeParser extends RegexParsers { | |
// 地域番号 ( "-" より前の 3 桁) | |
def regionCode: Parser[Int] = """[0-9]{3}""".r ^^ { _.toInt } | |
// "-" よりあとの 4 けた | |
def detailCode: Parser[Int] = """[0-9]{4}""".r ^^ { _.toInt } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID.randomUUID | |
object UUID extends App { | |
println(randomUUID) | |
} | |
object UUIDLower extends App { | |
println(randomUUID.toString.toLowerCase) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
namespace ExceptVsWhere | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
namespace LinqVsForEach | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 非ジェネリックな IEnumerable | |
ArrayList services = new ArrayList() {"Qiita", "GitHub", "AWS", "Azure"}; | |
// Cast<string>() で IEnumerable<string> にできる! | |
services.Cast<string>().Select(s => s.ToLower()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace IEnumerableSplit | |
{ | |
public static class IEnumerableExtensions | |
{ | |
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> source, int size) | |
{ | |
if (size <= 0) | |
{ | |
throw new ArgumentOutOfRangeException($"{nameof(size)} は 0 より大きくなければなりません"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = Enumerable.Range(1, 99).Split(10); | |
foreach (var splitted in result) | |
{ | |
System.Console.WriteLine(string.Join(",", splitted)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace AppliedITEnginnerMisc | |
{ | |
/// <summary> | |
/// ニュートン法の実装 | |
/// </summary> | |
public sealed class Newton | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" http://qiita.com/mfujimori/items/9fd41bcd8d1ce9170301 | |
" setting | |
"文字コードをUFT-8に設定 | |
set fenc=utf-8 | |
" バックアップファイルを作らない | |
set nobackup | |
" スワップファイルを作らない | |
set noswapfile | |
" 編集中のファイルが変更されたら自動で読み直す | |
set autoread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BuilderSample | |
{ | |
/// <summary> | |
/// immutable な Person class | |
/// </summary> | |
public class Person | |
{ | |
public string Name { get; } | |
public int Age { get; } |
OlderNewer