Skip to content

Instantly share code, notes, and snippets.

View hanachin's full-sized avatar
🌺
OKA

Seiei Miyagi hanachin

🌺
OKA
View GitHub Profile
@tompng
tompng / generator.rb
Last active July 17, 2019 14:47
mathfont for c (converter for https://github.com/tompng/mathfont)
class Node
attr_reader :to_s
def initialize op, a=nil, b=nil
if a.nil?
@to_s = op
return
end
case op
when :-@
@tompng
tompng / mouse_shape.c
Last active July 17, 2019 13:21
雑マウス
#include <stdio.h>
int main(){
int size = 24;
for(int y=0;y<size;printf("\n"),y++){for(int x=0;x<size;x++){
int size = 24;
float a=0.1+(y-1.8*x)/size;
float b=1.2-(x+1.8*y)/size;
float c=b+(a<0?-a:a);
float d=(b+c-1.4);
d=d*d*d*d;d=d*d;
module B
extend self
@enabled = false
def enable!
return if @enabled
clear
@enabled = true
rules:
- id: sample.abc
pattern:
subject: a.b.'c
where:
c: /.+/
message: a
examples:
- before: 'a.b.c'
after: 'a.b'
@atsunoda
atsunoda / text_injection.md
Last active September 2, 2022 22:37
脆弱性報奨金制度で認定されづらいテキストインジェクション
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
@tompng
tompng / human_kanji.html
Last active September 10, 2018 14:20
人という字は、人と人が支え合ってできています (フラクタル) https://twitter.com/tompng/status/1038799318398853121
<script>
const scaleRatio = 0.75
function humanFromCanvas(base, alpha){
const output = document.createElement('canvas')
const size = 1024
output.width = output.height = size
const ctx = output.getContext('2d')
ctx.globalAlpha = alpha || 1
ctx.translate(size/2, size/2)
ctx.scale(scaleRatio, scaleRatio)
def x;$x=!$x;end.tap do%)
def f(x)
if x
unless x
p :foo # ←ここに実行到達することは可能か?
end
end
end

SATySFi構文メモ (2018/02/23)

SATySFiの字句解析器には主要なモードが4つある:

  • プログラムモード
  • 垂直モード
  • 水平モード
  • 数式モード

またサブモードとして

puts %(
moved to https://github.com/tompng/top_n_loader
)
exit
module TopNRecords
def self.parse_order(klass, order)
key, mode = begin
case order
when Hash