Skip to content

Instantly share code, notes, and snippets.

View shinnya's full-sized avatar

foobar shinnya

  • Japan
View GitHub Profile
@shinnya
shinnya / gist:463159
Created July 4, 2010 05:16
[KeySnail] Copy URL to clipboard
key.setViewKey('M-u', function (ev, arg) \
{
display.echoStatusBar("Copy URL to clipboard");
command.setClipboardText(getBrowser().contentDocument.URL);
}, 'Copy URL to clipboard');
@shinnya
shinnya / gist:781990
Created January 16, 2011 18:02
A patch for zlc.el
--- zlc.el.org 2011-01-17 02:53:46.000000000 +0900
+++ zlc.el 2011-01-17 02:55:23.000000000 +0900
@@ -73,6 +73,11 @@
(zlc-minibuffer-complete)
ad-do-it))
+(defadvice PC-complete (around zlc--around-PC-complete activate)
+ (if zlc--mode
+ (zlc-minibuffer-complete)
+ ad-do-it))
--- 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
@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)
@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 / 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 / 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 / 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 / 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 {