Skip to content

Instantly share code, notes, and snippets.

View hanachin's full-sized avatar
🌺
OKA

Seiei Miyagi hanachin

🌺
OKA
View GitHub Profile
<html>
<head>
<title>Simple GraphiQL Example</title>
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" />
</head>
<body style="margin: 0;">
<div id="graphiql" style="height: 100vh;"></div>
<script type="module">
await import('https://unpkg.com/react/umd/react.production.min.js')
await import('https://unpkg.com/react-dom/umd/react-dom.production.min.js')
require 'date'
class Calendar
using Module.new {
refine(Date) do
def travel_back = Enumerator.produce(self, &:prev_day)
def travel_forward = Enumerator.produce(self, &:next_day)
def beginning_of_month = Date.new(year, month, 1)
def end_of_month = Date.new(year, month, -1)
end
@hanachin
hanachin / .gitignore
Created January 19, 2021 03:43
Klee OneのArch Linux用のパッケージ、cloneしてmakepkg -siで入る https://github.com/fontworks-fonts/Klee/
# https://gist.github.com/pablox-cl/6479725
# ignore everything
*
!.gitignore
# except PKGBUILD needed files
!PKGBUILD
!*.install
!ChangeLog
def f
sleep 1
end
BEGIN {
using Module.new {
refine(Kernel) do
def sleep *; end
end
}
type PathConverter<P> = (params: P) => string
type routes = {
boards: {
GET: {
pathParams: {}
bodyParams: {}
},
POST: {
pathParams: {}
bodyParams: { title: string }
require 'binding_of_caller'
using Module.new {
refine(Array) do
def map(&block)
caller = binding.of_caller(1)
cleanroom = Class.new(BasicObject) do
def respond_to?(*); true; end
def respond_to_missing?(*); true; end
@hanachin
hanachin / ractor_map.rb
Created April 15, 2020 13:06
Array#ractor_map
using Module.new {
refine(Array) do
def ractor_map(&block)
rs = map.with_index do |x, index|
r = Ractor.new(x, &block)
Ractor.new(r, index) do |r, index|
[r.take, index]
end
end
result = []
@hanachin
hanachin / unlgtm.side
Created March 12, 2020 18:05
Qiitaの「LGTM」を外すSelenium IDE
{
"id": "989d0c27-7ee2-437e-8a62-0bfc6b0297f4",
"version": "2.0",
"name": "unlgtm",
"url": "https://qiita.com/",
"tests": [{
"id": "254ccc0c-f1da-4788-824a-abf04e5a1ee6",
"name": "unlgtm",
"commands": [{
"id": "d82b553e-69c0-422c-8517-ea4f931cde9b",
// ==UserScript==
// @name Jump to GitHub from bugs.ruby-lang.org
// @namespace https://www.hanach.in/
// @version 0.1.0
// @description Add link to the commit on GitHub
// @author hanachin
// @match https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/*
// @grant none
// @run-at document-idle
// @license GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
@hanachin
hanachin / yami.rb
Last active November 19, 2019 04:20
tp = TracePoint.new(:call) do |tp|
next unless tp.method_id == :===
$v = tp.self
end
tp.enable
class C
def deconstruct_keys(keys)
result = {}
result[:k] = $v