Skip to content

Instantly share code, notes, and snippets.

View pocke's full-sized avatar
⌨️
Pocke is typing...

Masataka Pocke Kuwabara pocke

⌨️
Pocke is typing...
View GitHub Profile
require 'ripper'
class RipperEventViewer < Ripper::SexpBuilderPP
(Ripper::PARSER_EVENTS + Ripper::SCANNER_EVENTS).each do |ev|
eval <<~RUBY
def on_#{ev}(*args)
super.tap do
puts "#{'*'*50} on_#{ev}"
pp(*args)
end
$ ruby-2.5.1 test.rb
"local-variable"
"local-variable"
iabbrev differentiatiations differentiations
iabbrev disproportionaltely disproportionately
iabbrev oversimplificiation oversimplification
iabbrev transcendentational transcendental
iabbrev anthromorphization anthropomorphization
iabbrev disporportionately disproportionately
iabbrev dispraportionately disproportionately
iabbrev disproportianately disproportionately
iabbrev disproportionatley disproportionately
iabbrev disproprotionately disproportionately
def log(msg)
puts "[#{Time.now}]: #{msg}"
end
log 'start'
big_str = 'a' * 500_000_000
log 'prepared'
begin
big_str.a
rescue => ex
@pocke
pocke / README.md
Created August 20, 2018 00:45
namerror message patch
$ ruby test_before.rb # before patch
3.7357151369942585
$ ruby test.rb # after patch
1.2525334189995192

3.7357151369942585 / 1.2525334189995192 * 1000000 => 2982527.3164992435 times faster!

ほげaaa ほげ aaa

{
"scripts": {
"start": "tsc && node test.js"
},
"dependencies": {
"@types/node": "^10.12.12",
"lodash": "^4.17.11",
"typescript": "^3.2.2"
},
"devDependencies": {
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
# 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')
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}"