This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-key minibuffer-local-filename-completion-map "\C-l" '(lambda () (interactive) (insert-string (concat (helm-reduce-file-name (delete-and-extract-region (minibuffer-prompt-end) (point-max)) 1 ) "/")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
words = %w(ボ ン ジョ ヴィ) | |
targets = %w(ジョ ン ボ ン ジョ ヴィ) | |
recent = [] | |
num_generate = 0 | |
begin | |
num_generate += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(2..36).each do |base| | |
n = '1' * (base - 1) | |
puts "base: #{base} #{n} * #{n} = #{(n.to_i(base) ** 2).to_s(base)}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'pp' | |
def shuffle(array) | |
i = array.length | |
while 0 < i | |
i = i - 1 | |
j = (Random.rand * i).to_i | |
array[i], array[j] = array[j], array[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
VAGRANTFILE_API_VERSION = "2" | |
SERVERS = [ | |
{ hostname: "storm", ssh_forward: 2302, networks: [ { ip: "192.168.0.2", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "nimbus", ssh_forward: 2303, networks: [ { ip: "192.168.0.3", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server1", ssh_forward: 2304, networks: [ { ip: "192.168.0.4", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server2", ssh_forward: 2305, networks: [ { ip: "192.168.0.5", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server3", ssh_forward: 2306, networks: [ { ip: "192.168.0.6", virtualbox__intnet: "storm" } ] }, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo git clone https://github.com/tokuhirom/plenv.git /usr/local/plenv | |
sudo mkdir /usr/local/plenv/plugins | |
sudo git clone https://github.com/tokuhirom/Perl-Build.git /usr/local/plenv/plugins/perl-build | |
sudo sh -c 'PLENV_ROOT=/usr/local/plenv PATH="$PLENV_ROOT/bin/:$PLENV_ROOT/shims:$PATH" plenv install 5.18.2' | |
sudo sh -c 'PLENV_ROOT=/usr/local/plenv PATH="$PLENV_ROOT/bin/:$PLENV_ROOT/shims:$PATH" plenv install 5.20.1' | |
sudo sh -c 'PLENV_ROOT=/usr/local/plenv PATH="$PLENV_ROOT/bin/:$PLENV_ROOT/shims:$PATH" plenv install-cpanm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strcit' | |
var Promise = require('bluebird'); | |
function findUser(id) { | |
// return Promise.resolve({id: id}) | |
return Promise.reject('not found') | |
} | |
var user = findUser(12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-string-region-at-cursor () | |
(save-excursion | |
(let (beg) | |
(setq beg (nth 8 (parse-partial-sexp 1 (point)))) | |
(if beg | |
(progn | |
(goto-char beg) | |
(forward-sexp) | |
(list (1+ beg) (1- (point)))) | |
nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def undump | |
self.sub(/\A"/, '').sub(/"\z/, '').gsub(/\\(x([0-9a-f]{2})) | \\(u\{([0-9a-f]{4})\}) | \\(.) /ix) { | |
if $1 # \xXX | |
[$2.hex].pack("C") | |
elsif $3 # \u{xxxx} | |
[$4.hex].pack("U") | |
else # \. | |
case $5 | |
when 't' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Text::Xslate; | |
use Test::More; | |
my $tx = Text::Xslate->new(cache => 0, | |
function => { |
OlderNewer