Skip to content

Instantly share code, notes, and snippets.

@naoya
naoya / list.ts
Created August 30, 2022 23:12
TypeScript のタグ付きユニオンで再帰データ型を扱えるのか分からなくなったので試しにリストを実装
// TypeScript のタグ付きユニオンで再帰データ型を扱えるのか分からなくなったので試しにリストを実装
// 結論、扱えます
// Haskell でいうところの data List a = Empty | Cons a (List a)
interface Empty {
kind: "Empty"
}
interface Cons<T> {
kind: "Cons"
@naoya
naoya / og.coffee
Created October 19, 2011 10:13
Scraping OpenGraph w/ node + jsdom + jQuery
jsdom = require 'jsdom'
jsdom.env
html: 'http://b.hatena.ne.jp/articles/201110/6114'
scripts: [ 'http://code.jquery.com/jquery-1.6.4.min.js' ]
done: (errors, window) ->
$ = window.$
og = {}
$('meta[property^="og:"]').each () ->
og[ $(@).attr('property').match(/og:(.+)$/)[1] ] = $(@).attr 'content'

シェルTIPS 20min

コンピュータの方がうまくできることに人間を使うな。
-- Tom Duff

キーバインド

Emacs の基本操作とおなじ。

# $Id: screen-keys.conf,v 1.7 2010-07-31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
# -*- coding: utf-8 -*-
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(
MainViewController.new
)
@window.makeKeyAndVisible
watch_clipboard
@naoya
naoya / netgame_life.md
Last active April 18, 2018 04:54
ネットゲーマーとMBAコンサルタント

海岸沿いの小さな村に、MBAをもつアメリカのコンサルタントが訪れた。 あるネットゲーマーの画面を見ると活きのいいキャラが育っている。

コンサルタントは聞いた。

「いいキャラですね。レベルカンストにはどのくらいの時間かかるのですか?」 「そうだな、1,000時間ってとこだな。」

「まだ日は高いのに、こんなに早くログインしてどうするのですか?」

問題

wiki はストックで blog はフロー、という考えで

  • 某ツールはストック (※)
  • Qiita Team はフロー

みたいな感じで皆捉えているけども、よく考えるとなぜ Qiita Team はフロー、と当然ように納得してしまっているのか。思考停止しているのではないかということを今少し思った。

仮に自分が同じようなものを作るとしても、一つのツールでフローとストックを両方面倒みれる道具にするには、ここを掘り下げて考えきれないといけない。

import sys
import os
from keyhac import *
import ckit
def configure(keymap):
not_emacs_target = [
"com.googlecode.iterm2",
"com.apple.Terminal",