Skip to content

Instantly share code, notes, and snippets.

-module(folder).
-author("Takahiro Kondo <[email protected]>").
-export([fold/1, fold/2]).
-export([example/0]).
-define(DEFAULT_SEPARATOR, ".").
fold(Dict) ->
fold(Dict, ?DEFAULT_SEPARATOR).
-module(folder).
assign(Dict, [LastPart], Value) ->
Dict:store(LastPart, Value);
assign(Dict, [Part|Tail], Value) ->
NewDict = case Dict:exists(Part) of
ok -> assign(Dict:fetch(Part), Tail, Value);
error -> assign(dict:new(), Tail, Value)
end,
@takkkun
takkkun / wrap.vim
Last active December 16, 2015 18:39
function! s:toggle_wrap()
if &wrap
set nowrap
nnoremap <buffer> j j
nnoremap <buffer> k k
nnoremap <buffer> 0 0
nnoremap <buffer> ^ ^
nnoremap <buffer> $ $
require 'mkmf'
have_header('mecab.h') && have_library('mecab') && create_makefile('hijiki')
resources :items do
member do
post 'favorite' => 'items#favorite'
delete 'favorite' => 'items#unfavorite'
end
end
constants = []
current_expr = nil
set_trace_func lambda { |event, file, line, id, binding, klass|
if current_expr
e, b = current_expr
if b.eval("defined? #{e}") == 'constant'
const = b.eval(e)
constants << const unless constants.include?(const)
class Neko
%w(public protected private).each do |method_name|
original_method = method(method_name)
define_singleton_method(method_name) do |*args, &block|
puts "Called: #{method_name}"
original_method[*args, &block]
end
end

git + markdownで管理/記述するブログについて

いきさつ

「CMSでブログ書くのダルくね? やっぱ使い慣れたテキストエディタが一番でしょ」

という声が聞こえてくると言うか、プログラマならそう思っちゃうのは自然の摂理。

概要

#!/usr/bin/env ruby
require 'thor'
module Example
class App < Thor
desc 'install', 'install something'
def install
puts 'run example:app:install'
end
use strict;
use warnings;
sub list {
qw/a b c/;
}
sub array {
my @array = qw/a b c/;
@array;