# 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: []
rules: | |
- id: sample.abc | |
pattern: | |
subject: a.b.'c | |
where: | |
c: /.+/ | |
message: a | |
examples: | |
- before: 'a.b.c' | |
after: 'a.b' |
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 |
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 |
# 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, |
// 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); |
require 'slack' | |
Slack.configure do |conf| | |
conf.token = ENV.fetch('SLACK_TOKEN') | |
end | |
client = Slack::Web::Client.new | |
channel_names = client.channels_list(exclude_archived: true).channels.reject(&:is_member).map(&:name) | |
channel_names.each do |name| | |
puts "Join to #{name}" |
# Maintainer: Kohei Suzuki <[email protected]> | |
pkgname=bdash | |
pkgver=1.5.3 | |
pkgrel=1 | |
pkgdesc='Simple business intelligence application' | |
arch=('x86_64') | |
url='https://github.com/bdash-app/bdash' | |
license=('MIT') | |
depends=('gtk2' 'nss' 'alsa-lib' 'libxss' 'gconf' 'libxtst') | |
makedepends=('python2' 'python' 'npm' 'yarn') |
class Module | |
def to_enum(method_name) | |
original_method_name = :"__{method_name}_orig__" | |
alias_method original_method_name, method_name | |
define_method(method_name) do |*args, &block| | |
return enum_for(method_name, *args) unless block | |
__send__ original_method_name, *args, &block | |
end | |
end | |
end |
{ | |
"scripts": { | |
"start": "tsc && node test.js" | |
}, | |
"dependencies": { | |
"@types/node": "^10.12.12", | |
"lodash": "^4.17.11", | |
"typescript": "^3.2.2" | |
}, | |
"devDependencies": { |