Skip to content

Instantly share code, notes, and snippets.

View oieioi's full-sized avatar
🐙
🐙🐙🐙🐙🐙🐙🐙🐙🐙

oieioi

🐙
🐙🐙🐙🐙🐙🐙🐙🐙🐙
View GitHub Profile
@oieioi
oieioi / disable-keybindings-on-notion.user.js
Created June 7, 2023 02:17
Disable keybingings on Notion.so
// ==UserScript==
// @name stop keybindings
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.notion.so/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=notion.so
// @grant none
// ==/UserScript==
class Hash
def to_struct
klass = Struct.new(*keys.map(&:to_sym).uniq, keyword_init: true)
klass.new(self)
end
end
pp({ :keys => 'arienai', 'keys' => 'unko'}.to_struct)
@oieioi
oieioi / .git_hooks_post-checkout
Created June 10, 2022 00:47
ripper-tags when git checkouted
#! /bin/sh
echo 'Run ripper-tags on background...'
(ripper-tags -R > /dev/null) &
@oieioi
oieioi / disable-ctrl-h-in-new-relic.user.js
Created November 19, 2021 02:19
Disable ctrl+h to return page in New Relic
// ==UserScript==
// @name Disable ctrl+h to return page
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Disable ctrl+h to return page
// @author oieioi
// @match https://one.newrelic.com/launcher/*
// @grant none
// ==/UserScript==
require 'benchmark'
time = 100_000_0
ary = [1,1,1,1,1,1,1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,2,1,2,1]
puts "Array#uniq:#{Benchmark.realtime { time.times { ary.uniq } }}"
puts "Array#| :#{Benchmark.realtime { time.times { ary | [] } }}"
@oieioi
oieioi / server.js
Last active June 25, 2021 04:54
ローカルでたてて適当なHTTPを受け付けるやつ
const http = require('http')
const SLEEP_MSEC = 1000;
let count = 1;
console.log('hello, world')
const server = http.createServer((req, res) => {
count++
const number = count
console.log(`req: ${number}
require 'active_support/all'
def main
rb_file_paths_raw = `find app -type f -name '*.rb'`
rb_file_paths = rb_file_paths_raw.split("\n")
rb_file_paths.each do |file_name|
spec_file_name = file_name.sub(/^app/, 'spec').sub(/.rb$/, '_spec.rb')
@oieioi
oieioi / collect-env.sh
Last active June 10, 2021 07:01
Collecte ENV keys from Ruby project
git grep -h -o -E "ENV(\[|\.fetch).*"|
ruby -ane 'puts $_.match(%r|['\''"](.+?)["'\'']|)[1]' |
sort |
uniq
@oieioi
oieioi / post-checkout
Last active May 13, 2021 12:30
.git/hook/post-checkout で ctags を実行する
#! /bin/sh
echo 'Run ctags in background...'
(/usr/local/bin/ctags -R . > /dev/null 2>&1) &
class Klass
CONST_1 = 1
class << self
CONST_2 = 2
def klass_method
# ok
puts CONST_1
# ok