Skip to content

Instantly share code, notes, and snippets.

(SUMMARY)

Language Library Name Type
C# CsvHelper QuoteAllFields bool
Go (stdlib) N/A N/A
Haskell cassava Quoting.QuoteAll enum
Java Apache Commons CSV QuoteMode.ALL enum
Python (stdlib) QUOTE_ALL enum
Ruby fastercsv force_quotes bool
@maiha
maiha / 0.25.md
Last active June 27, 2018 04:54
Crystal breaking changes

std

JSON

  • JSON::Type is moved to JSON::Any::Type
-  def [](key) : YAML::Type
+  def [](key) : YAML::Any::Type

[OK] 1.rb

require "json"

def convert_to_json(obj)
  obj.to_json
end

p convert_to_json(1)   # => "1"
p convert_to_json("x") # => "\"x\""
@maiha
maiha / 0.kafkaのexactly once.md
Last active April 4, 2018 21:55
kafka-1.0-exactly-once

情報

概要

  • kafka-0.11 で導入された idempotent producer によって同一パーティション内の冪等性を保証
  • produce request v3 で導入された transaction 機能により、複数メッセージのアトミック処理を保証

チートシート(擬似コード)

class CompositeLogger
def initialize(@loggers : Array(Logger) = loggers)
end
macro method_missing(call)
@loggers.each do |logger|
logger.{{call}}
end
end
end

active_record.cr - Active Record pattern implementation

  • ⚠️ activity last commit is 1 year ago
  • MySQL driver : libmysql(C API)
  • agnostic FREE
  • define fields simple
  • table name supports camel class name
  • model level query lacks first, count
  • low level adapter hard to access
  • relations
  • ⚠️ multibytes can't set charset in default (needs monkey patch)
@maiha
maiha / sbt-sonatype.md
Last active November 22, 2017 03:42
SBTでcross-buildingしてmavenにあげようとしたらエラーになった時の作業メモ

+ で全バージョン一気にやって欲しい

> + sonatypeRelease
[info] Setting version to 2.12.4
[info] Reapplying settings...
[info] Set current project to http-mock (in build file:/home/maiha/git/maiha/http-mock/)
[info] Nexus repository URL: https://oss.sonatype.org/service/local
[info] Reading staging repository profiles...
[error] Multiple repositories are found:
@maiha
maiha / b.union.md
Last active November 8, 2017 19:47
complex return value in crystal

implementation

enum Pcap::NextError
  EOF     = -2 # EOF or pcap_breakloop
  ERROR   = -1 #
  TIMEOUT =  0 # should be continued
end

class Pcap::Capture

アタックリスト

  • 牛庵(別)
  • びっくりうどん
  • 親子丼(◯勝)
  • 天丼(インズ)
  • 韓国料理(検校)