Skip to content

Instantly share code, notes, and snippets.

ujihisa

Block or report user

Report or block ujihisa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:cf564b4f97c2bfda2a3858b36e0a239a
https://www.nenkin.go.jp/shinsei/kokunen.html
https://www.nenkin.go.jp/shinsei/kokunen.files/654-1credit.pdf
View gorilla-grep.vim
function! s:flatten(xss) abort
let memo = []
for xs in a:xss
for x in xs
call add(memo, x)
endfor
endfor
return memo
endfunction
View caller_locations-with-columns.patch
$ d
diff --git a/vm_backtrace.c b/vm_backtrace.c
index bb01983a7c..de7b961174 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -47,6 +47,28 @@ calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
return rb_iseq_line_no(iseq, pos);
}
+inline static int
View rubykaigi2019-ujihisa-play-with-local-vars.md

Play with local vars

While waiting for my talk, guess what does it output without actually running it.

View put_in.rb
def put_in_f(hash, keys, value)
if keys.empty?
value
else
car, cdr = [keys[0], keys[1..]]
hash.merge(car => put_in_f(hash[car], cdr, value))
end
end
def extract(binding, ast)
View wordcount.vim
let s:S = vital#vital#import('Data.String')
let s:L = vital#vital#import('Data.List')
function! s:count_words(text) abort
let F = { memo, x -> has_key(memo, x)
\ ? extend(memo, {x: memo[x] + 1})
\ : extend(memo, {x: 1})}
return s:L.foldl(F, {}, s:S.scan(a:text, '\w\+'))
endfunction
View asakusa.rb
def give_ujihisa_money(users, value)
# users[:ujihisa][:money] = 24
update_in2(-> { users[:ujihisa][:money] }, 24)
# put_in(users[:ujihisa][:money], 24)
# dig <-> bury
end
def update_in2(f, value)
pp RubyVM::InstructionSequence.of(f).to_a
nil
View wip.rb
#!ruby -v
ALL_PERKS = {
PER: ['Gunslinger', 'Shotgun Messiah', 'Automatic Weapons', 'Dead Eye', 'Archery', 'Explosive Weapons', 'Boom! Headshot!', 'Run And Gun', 'Lucky Looter', 'Salvage Operations'],
STR: ['Wrecking Crew', 'Sexual Tyrannosaurus', 'Flurry of Blows', 'Deep Cuts', 'Stay Down!', 'Heavy Metal', 'Skull Crusher', 'Miner 69\'er', 'Pack Mule', 'Mother Lode'],
FRT: ['Heavy Armor', 'The Huntsman', 'Intrinsic Immunity', 'Well Insulated', 'Living Off The Land', 'Pain Tolerance', 'Healing Factor', 'Fully Hydrated', 'Slow Metabolism', 'Self Medicated'],
AGI: ['Rule 1: Cardio', 'Light Armor', 'Charging Bull', 'Parkour', 'Olympic Swimmer', 'Ninja Movement', 'Hidden Strike', 'From Shadows'],
INT: ['Better Barter', 'The Daring Adventurer', 'Charismatic Nature', 'Hammer & Forge', 'Grease Monkey', 'Advanced Engineering', 'Yeah, Science!', 'Physician', 'Master Chef']
}
View version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 8 2018 11:23:48)
Included patches: 1-570
Compiled by Arch Linux
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +clientserver +diff +folding +libcall +mouse_gpm +packages +ruby/dyn +termguicolors +visual +xsmp_interact
+arabic +clipboard +digraphs -footer +linebreak -mouse_jsbterm +path_extra +scrollbind +terminal +visualextra +xterm_clipboard
+autocmd +cmdline_compl +dnd +fork() +lispindent +mouse_netterm +perl/dyn +signs +terminfo +viminfo -xterm_save
+autochdir +cmdline_hist -ebcdic +gettext +listcmds +mouse_sgr +persistent_undo +smartindent +termresponse +vreplace
-autoservername +cmdline_info +emacs_tags
View log_py3_deoplete
2019-01-03 16:20:44,037 [DEBUG @ msgpack_stream.py:send:34] 22202 - sent [0, 1, b'vim_get_api_info', ()]
2019-01-03 16:20:44,038 [DEBUG @ base.py:send:117] 22202 - Sending 'b'\x94\x00\x01\xb0vim_get_api_info\x90''
2019-01-03 16:20:44,038 [DEBUG @ base.py:run:142] 22202 - Entering event loop
2019-01-03 16:20:44,042 [DEBUG @ msgpack_stream.py:_on_data:59] 22202 - waiting for message...
2019-01-03 16:20:44,042 [DEBUG @ msgpack_stream.py:_on_data:61] 22202 - received message: [1, 1, None, [1, {b'version': {b'major': 0, b'api_level': 1, b'api_prerelease': False, b'patch': 7, b'api_compatible': 0, b'minor': 1}, b'types': {b'Window': {b'id': 1, b'prefix': b'nvim_win_'}, b'Tabpage': {b'id': 2, b'prefix': b'nvim_tabpage_'}, b'Buffer': {b'id': 0, b'prefix': b'nvim_buf_'}}, b'functions': [{b'method': True, b'name': b'nvim_buf_line_count', b'return_type': b'Integer', b'parameters': [[b'Buffer', b'buffer']], b'since': 1}, {b'method': False, b'deprecated_since': 1, b'name': b'buffer_get_line', b'return_type': b'String', b'
You can’t perform that action at this time.