# return 1のreturnはあってもなくても変わらないので、消える。 def foo() return 1 if cond; something end なら消えない。
pp RubyVM::AbstractSyntaxTree.parse("def foo() return 1 end")
(SCOPE@1:0-1:27
tbl: []
// Sync personal calendar to work calendar | |
function syncCalendar() { | |
var FROM_EMAIL = '[email protected]'; | |
var TO_EMAIL = '[email protected]'; | |
var HUB_CALENDAR_ID = '[email protected]' | |
var from_events = getEvents(FROM_EMAIL); | |
var hub_events = getEvents(HUB_CALENDAR_ID); | |
var hub_cal = CalendarApp.getCalendarById(HUB_CALENDAR_ID); |
# ref: https://tama-san.com/kanji-regex/ | |
kanji = [ | |
*("\u{2E80}".."\u{2FDF}").to_a, | |
"\u{3005}", | |
"\u{3007}", | |
"\u{303B}", | |
*("\u{3400}".."\u{4DBF}").to_a, | |
*("\u{4E00}".."\u{9FFF}").to_a, | |
*("\u{F900}".."\u{FAFF}").to_a, | |
*("\u{20000}".."\u{2FFFF}").to_a, |
module Cacheable | |
def cache(method_name) | |
orig_name = :"__orig__#{method_name}" | |
alias_method orig_name, method_name | |
define_method method_name do | |
__send__(orig_name).tap do |res| | |
self.class.class_eval do | |
undef_method method_name | |
undef_method orig_name | |
define_method method_name do |
function! Rainbow(_) abort | |
let colors = ['Blue', "Green", "Cyan", "Red", "Magenta", "Yellow"] | |
let groups = ['Normal', 'Constant', 'Identifier', 'Statement', 'Special'] | |
let offset = g:rainbow_idx % len(colors) | |
let idx = 0 | |
for g in groups | |
let color = colors[(idx + offset) % len(colors)] | |
execute "hi " . g . " ctermfg=" . color | |
let idx += 1 |
rules: | |
- id: sample.abc | |
pattern: | |
subject: a.b.'c | |
where: | |
c: /.+/ | |
message: a | |
examples: | |
- before: 'a.b.c' | |
after: 'a.b' |
# Hello, world!を出力するプログラム | |
require 'akaza' | |
Akaza.eval(" | |
require 'akaza' | |
class A | |
extend Akaza::Annotation | |
whitespace def sum(input, output) | |
This code is never evaluated. |
require 'akaza' | |
class A | |
extend Akaza::Annotation | |
whitespace def sum(a, b) | |
input=StringIO.new("#{a}\n#{b}\n") | |
output=StringIO.new |