Skip to content

Instantly share code, notes, and snippets.

View rosylilly's full-sized avatar
🕊️
Happy Hacking

Sho Kusano rosylilly

🕊️
Happy Hacking
View GitHub Profile
@rosylilly
rosylilly / dci.go
Last active August 29, 2015 14:00
これ DCI なんでは?
package main
import (
"fmt"
)
type User struct {
Name string
}
puts "Hello, World"
STDOUT.puts "Hello, World"
class Point
property :x, :y
def initialize(@x, @y)
end
end
@rosylilly
rosylilly / index.html
Last active August 29, 2015 14:26
WTF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS TEST</title>
</head>
<body>
<script type="text/javascript">
(function() {
"use strict";
class CS5
Pseudo_Classes = [
/root/,
/nth\-child\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-last\-child\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-of\-type\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-last\-of\-type\((\d+n\+\d+|\d+|odd|even)\)/,
/first\-child/,
/last\-child/,
/first\-of\-type/,
@rosylilly
rosylilly / Object_overide.rb
Created February 3, 2009 20:57
Prototype class for ruby
class Object
def method_missing( _method, *arg)
_method = _method.to_sym
if (_method.to_s[_method.to_s.size - 1] == ?=) && ( arg[0].class == Proc)
target = (self.class == Class ? self : self.class)
target.class_eval do
define_method( _method.to_s[0, _method.to_s.size - 1].to_sym, arg[0].binding)
end
else
raise NoMethodError, "undefined method `#{_method}' for #{self.inspect}:#{self.class}", caller(1)
@rosylilly
rosylilly / prototype.rb
Created April 12, 2009 16:41
Prototypical Objects on ruby
class Prototype
def new(member = {}, &block)
prototype(member || {}, self,&block)
end
def respond_to?(name)
return self if methods.include?(name.to_s)
__proto__ = @proto.respond_to?(name)
return __proto__ if __proto__
false
@rosylilly
rosylilly / index.cgi
Created July 5, 2009 03:34
違う、違うんだ。俺が悪いんじゃない。アイツが俺を殺そうとしたから……!
#!ruby path
ENV['GEM_HOME'] = "gem path"
require 'rubygems'
require 'cgi'
require 'RMagick'
require 'kconv'
print "Content-Type: text/html\n\n"
class Object
def self_methods
methods.map{|m|
m=method(m.to_sym)
(m.owner == self.class ? m.name : nil )
}.compact
end
end
p ''.methods.sort
Class.class_eval do
undef :allocate
end
begin
p Class.new
rescue => e
p e
end
# => <Class:0x*******>
#nil# Public local sketchbook
Desktop Templates log src
Documents Videos obj themes
Examples bin page-speed-images tmp
Firefox_wallpaper.png dev page-speed-javascript デスクトップ
Music hsptmp salasaga 編集中のドキュメント 1
Pictures j602 server