Skip to content

Instantly share code, notes, and snippets.

Yuta Okamoto okapies

Block or report user

Report or block okapies

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
okapies / HogeOps.scala
Created Jan 30, 2014
scalac is crazy with private[this] in value class
View HogeOps.scala
class HogeOps(val underlying: Any) extends AnyVal {
[this] // <-- !!!
def toOption[A](v: => A): Option[A] = ???
View MessageLogger.scala
import scala.annotation.tailrec
import org.joda.time._
import com.github.tototoshi.slick.H2JodaSupport._
object MessageLogger extends App {
val profile = scala.slick.driver.H2Driver
okapies /
Last active Aug 29, 2015
FP in Scala chapter notes - Chapter 11: Monads
okapies / Prob.hs
Last active Dec 10, 2015
An example code for "Making monads" in "Learn You a Haskell for Great Good!".
View Prob.hs
-- usage: joinProb $ fmap sort flipThree
-- joinProb $ fmap (all (==Tails)) flipThree
import Control.Monad
import Data.Function (on)
import Data.List (groupBy, sortBy)
import Data.Ord (comparing)
import Data.Ratio
newtype Prob a = Prob { getProb :: [(a, Rational)] } deriving Show
okapies / gist:7182102
Last active Dec 26, 2015
Value type as Sum types
View gist:7182102
// value class
class Param(val i: Int) extends AnyVal
implicit def asParam(i: Int) = Param(i)
// followings are invalid because `Param` is a final class.
case class AnyParam(_i: Int) extends Param(_i)
case object ConstantA extends Param(-1)
okapies / part7.scala
Last active Dec 29, 2015
「プログラマの為の数学勉強会」の資料を ScalaNLP で写経してみたかった
View part7.scala
import breeze.linalg._
* p.15 (
* Note: Does breeze basically recommend side effects?
* Note: The compiler will complain 'could not find implicit value for parameter canMapValues'
* if you make the type parameter 'Int' as a generic type.
def matAdd(a: DenseMatrix[Int], b: DenseMatrix[Int]) =
View Ergo-JIS-layout.kbd.json
"name": "Ergo-JIS layout",
"author": "@okapies",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Red",
"pcb": true
View Ergo-JIS-layout.kbd.json
"name": "Ergo-JIS layout",
"author": "@okapies",
"switchMount": "cherry",
"switchBrand": "gateron",
"switchType": "KS-3-Red",
"pcb": true
okapies / keymap.c
Created Nov 3, 2017
QMK Layer Tap (LT) in Let's Split
View keymap.c
#include "lets_split.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
okapies / QueryOptionalColumn.scala
Created Nov 18, 2017
Problem in filtering an optional column in Slick 3.2
View QueryOptionalColumn.scala
// ref.
// See the example in
// I add an optional `buyer` column to Suppliers:
class Suppliers(tag: Tag) extends Table[(Int, String, String, String, String, String, Option[String])](tag, "SUPPLIERS") {
def buyer = column[Option[String]]("BUYER")
You can’t perform that action at this time.