Skip to content

Instantly share code, notes, and snippets.

View aoiroaoino's full-sized avatar
🏠
Working from home

Naoki Aoyama aoiroaoino

🏠
Working from home
View GitHub Profile
@greymd
greymd / yamaya_fib.md
Last active February 20, 2023 08:12
yamayaさんの難読化シェル芸(フィボナッチ数列) 解説

yamayaさんの難読化シェル芸(フィボナッチ数列) 解説

経緯

(1) ある日、yamaya さんという怖い方がこのツイートを投稿する。

yamaya_src

@densh
densh / Snake.scala
Last active December 19, 2021 05:05
Snake game in 200 lines of Scala Native and SDL2 as demoed during Scala Matsuri 2017
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
@kmizu
kmizu / how_to.md
Last active January 26, 2017 07:13
プログラミング言語ハンズオン:提案構文拡張

二項演算子の追加(難易度:★)

  • 累乗演算子の追加
  • 剰余演算子の追加
  • 代入系演算子の追加 +=, -= ...

構文の追加(難易度:★★)

  • for構文
@mala
mala / a.md
Last active June 30, 2020 15:13
Chrome ExtensionのLive HTTP Headersの調査(CoolBar.Pro導入 Extensionが何を行うかの調査)

Chrome ExtensionのLive HTTP Headersを調査した。Firefox用のものではない。Firefox用のものではない。

11/7追記

English version: https://translate.google.com/translate?sl=ja&tl=en&js=y&prev=_t&hl=ja&ie=UTF-8&u=https%3A%2F%2Fgist.github.com%2Fmala%2Fe87973df5029d96c9269d9431fcef5cb&edit-text=&act=url

Summary in english.

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
@gakuzzzz
gakuzzzz / 0_readme.md
Last active September 25, 2023 06:40
MapStreamSyntax

Java8 の Stream で Map を操作するサポート作った

MapStreamSyntax というクラスで基本的に static import して使います。

具体例を見てもらえばどの辺が便利なのか伝わるでしょうか?

Case.1

// JDK標準APIのみ
public Map<Integer, String> Case1_Before(final Map<Integer, String> map) {
@voluntas
voluntas / webrtc.rst
Last active April 25, 2024 12:30
WebRTC コトハジメ
@xuwei-k
xuwei-k / FreePreArrow.scala
Created August 3, 2015 16:19
Free PreArrow
package scalaz
/**
* @see [[http://www.fceia.unr.edu.ar/~mauro/pubs/Notions_of_Computation_as_Monoids.pdf]]
*/
sealed abstract class FreePreArrow[F[_, _], A, B] extends Product with Serializable {
def mapfst[AA](f: AA => A)(implicit F: Profunctor[F]): FreePreArrow[F, AA, B] =
FreePreArrow.instance[F].mapfst(this)(f)
def mapsnd[BB](f: B => BB)(implicit F: Profunctor[F]): FreePreArrow[F, A, BB] =
@gakuzzzz
gakuzzzz / slide.md
Last active August 10, 2021 08:50
Free-ScalikeJDBC から見る合成可能なDSLの作り方

Free-ScalikeJDBC から見る合成可能なDSLの作り方

2015/07/24 関数型Scalaの集い

自己紹介

@gakuzzzz
gakuzzzz / file.md
Last active June 23, 2019 13:51
UserId など値型はどうするべきか

UserId などの型はどうするべきか

1. primitive 型をそのまま使う

case class Person(id: Long, name: String, organizationId: Long)
object Person {

  def groupByOrg: Map[Long, Seq[Person]] = ...