Skip to content

Instantly share code, notes, and snippets.

@tmatz
tmatz / HowToUseWnnEngine.java
Last active August 29, 2015 14:07
How To Use WnnEngine
package my.package.name;
import jp.co.omronsoft.openwnn.JAJP.OpenWnnEngineJAJP;
import jp.co.omronsoft.openwnn.JAJP.Romkan;
import jp.co.omronsoft.openwnn.ComposingText;
import jp.co.omronsoft.openwnn.StrSegment;
import jp.co.omronsoft.openwnn.WnnWord;
import jp.co.omronsoft.openwnn.LetterConverter;
public class MainActivity extends Activity

vis.js の改造

vis.js は矢印の形をかえることができないので、UML 的な図を書くことができない。

改造できないか調べてみる

ubuntu で vis.js をビルドする

git clone https://github.com/almende/vis.git

vis.js を使って graphvis の dot スクリプトを表示する方法

<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.15.0/vis.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.15.0/vis.min.css" />
</head>

ubuntu のターミナルでクリップボードを使う方法

sudo apt-get install xsel

コピー

echo hogehoge | xsel --clipboard --input
@tmatz
tmatz / ASTGeneratorAndEvaluator.cs
Last active February 17, 2019 06:16
LL(1) Recursive Descent Parser
//
// AST Generator & Evaluator
// based on Recursive Descent Parser without back-tracking
//
// Syntax
//
// E := T { [ '+' '-'' ] E }
// T := U { [ '*' '/' '%' ] T }
// U := [ '+' '-' '' ] F
// F := '(' E ')' | [ '0' '1' ... '9' ]
@tmatz
tmatz / ExpressionConverter.cs
Last active February 27, 2019 06:09
ExpressionConverter: WPF UniversalConverter
//
// ExpressionConverter
//
// Syntax
//
// Top = '$' CStr | . Expr .
// CStr = cs { '{' . Expr . '}' cs }*
// Expr = Lor . '?' . Expr . ':' . Expr
// Expr = Lor
// Lor = Land { . '||' . Lor }
@tmatz
tmatz / enumerable.js
Last active March 19, 2019 05:21
JavaScript LINQ-like collection evaluation
test('try implement LINQ.', () => {
class Enumerable {
static from(array) {
return new Enumerable(
function*() {
yield* array;
})
}
constructor(generator) {
"use strict"
const curry = fn =>
curryN(fn.length, fn)
const curryN = (n, fn) =>
rename(fn.name, (...a) => {
const num_ = count_(a)
const len = a.length - num_
return (num_ == 0 && len >= n) ?
@tmatz
tmatz / TaskEx.cs
Last active April 1, 2019 09:13
use Task like a Promise
using System;
using System.Threading;
using System.Threading.Tasks;
namespace WpfAsyncCommandTest
{
public static class TaskEx
{
/// <summary>
/// 非同期処理を実行するアクションです。
// Trampoline:
// Tail recursion optimization technique.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;