Skip to content

Instantly share code, notes, and snippets.

View shinnya's full-sized avatar

Shinya Yamaoka shinnya

  • Japan
View GitHub Profile
@shinnya
shinnya / minscalaactors.scala
Created April 4, 2018 00:14 — forked from viktorklang/minscalaactors.scala
Minimalist Scala Actors
/*
Copyright 2012 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@shinnya
shinnya / gist:fead52c14f40efab7e881914973a383b
Created January 8, 2018 12:49 — forked from olifante/gist:222879
Interview with Joe Armstrong & Simon Peyton Jones

extracted from http://www.infoq.com/interviews/armstrong-peyton-jones-erlang-haskell

I'm Sadek Drobi. I'm here at Erlang Factory with Simon Peyton Jones and Joe Armstrong. Can you please tell us about yourselves and what you've been busy with lately?

JA: I'm Joe Armstrong and I'm at Erlang Factory. I've just been to a very nice talk where Simon has told us about the birth of Haskell and Erlang and how they point along parallel routes solving the same problems. I think we can talk a bit about that, because in your lecture you said things about "We tried that

@shinnya
shinnya / Main.scala
Last active March 20, 2018 21:37
An example of FP testing using Continuation
import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.language.higherKinds
import scalaz.ContT
import scalaz.std.scalaFuture.futureInstance
object Main {
@shinnya
shinnya / treap.ml
Last active September 11, 2017 12:31
Treap in OCaml
(*
* Copyright (C) 2017 Shinya Yamaoka
* Licensed under the MIT License.; you may not use this file except in
* compliance with the license. You may obtain a copy of the License at
* https://opensource.org/licenses/mit-license.php
*)
module Treap = struct
type 'a t = Empty | NonEmpty of 'a node
and 'a node = {
size: int;
@shinnya
shinnya / create-temp-dir.yml
Created October 15, 2016 04:02 — forked from pgilad/create-temp-dir.yml
Create a temp dir cross-platform in ansible
- name: create a local temp directory
local_action:
module: command mktemp -d "{{ lookup('env', 'TMPDIR') | default('/tmp/') }}ansible.XXXX"
register: mktemp_output
@shinnya
shinnya / composing service layers in scala.md
Created October 6, 2016 14:57 — forked from aappddeevv/composing service layers in scala.md
scala, cake pattern, service, DAO, Reader, scalaz, spring, dependency inejection (DI)

#The Problem We just described standard design issues you have when you start creating layers of services, DAOs and other components to implement an application. That blog/gist is here.

The goal is to think through some designs in order to develop something useful for an application.

#Working through Layers If you compose services and DAOs the normal way, you typically get imperative style objects. For example, imagine the following:

  object DomainObjects {
@shinnya
shinnya / configure
Last active August 25, 2016 19:33
This is excerpt from configure for PHP and describes how configure script decides OPENSSL_LIBDIR.
# If you specify --with-openssl-dir=yes, pkg-config is used and found_openssl is set to true.
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
if $PKG_CONFIG --atleast-version=0.9.6 openssl; then
found_openssl=yes
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
else
as_fn_error $? "OpenSSL version 0.9.6 or greater required." "$LINENO" 5
fi
@shinnya
shinnya / ReaderMonad.scala
Last active September 10, 2017 06:22
Reader Monad
/*
* Copyright (C) 2017 Shinya Yamaoka
* Licensed under the MIT License.; you may not use this file except in
* compliance with the license. You may obtain a copy of the License at
* https://opensource.org/licenses/mit-license.php
*/
object ReaderMonad {
class Reader[-E, +R] private (g: E => R) {
def apply(env: E): R = g(env)
--- incr-0.2.zsh.original 2009-07-26 01:57:53.000000000 +0900
+++ incr-0.2.zsh 2012-10-20 13:21:13.054870542 +0900
@@ -7,6 +7,7 @@
zle -N vi-cmd-mode-incr
zle -N vi-backward-delete-char-incr
zle -N backward-delete-char-incr
+zle -N backward-kill-word-incr
zle -N expand-or-complete-prefix-incr
compinit