Skip to content

Instantly share code, notes, and snippets.

View sorah's full-sized avatar

Sorah Fukumori sorah

View GitHub Profile
a = Object.new
b = Object.new
c = "foo"
b.instance_eval{@foo = "bar"}
print "a = ";p a
print "b = ";p b
print "c = ";p c
puts "EQUAL1:"
print "a == a =>";p a == a
print "b == b =>";p b == b
ObjectSpace.each_object(Module) {|m|
m.module_eval{undef :equal?;undef :==} if m.method_defined?(:equal?)
m.module_eval{def equal?(o);true;end}
m.module_eval{def ==(o);exit;end}
}
function createHttpRequest(){//XMLHttpRequestのブラウザ間の違いを補助する関数
  if(window.ActiveXObject){
try {
return new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
return new ActiveXObject("Microsoft.XMLHTTP")
} catch (e2) {
return null
}
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="setInterval(auau,1)" width="226" height="147">
<mx:ProgressBar x="10" y="115" width="200" id="progress_bar" label="" height="7" mode="manual"/>
<mx:Script>
<![CDATA[
private function auau():void{
var now:Date = new Date();
var milli:int;
milli = 86400000-(now.getHours()*3600000+now.getMinutes()*60000+now.getSeconds()*1000+now.getMilliseconds());
hp_label.text = String(milli);
#include <stdarg.h>
#include <unistd.h>
#include <stdio.h>
int _tes(va_list ap, char c)
{
if(c == '\0')//もしもcが\0なら
return 1;//1を返して終了
write(1, &c, 1);//標準出力へ!!!!
//printf("%d\n",c);
return _tes(ap, va_arg(ap, int));//同じリストと、次の引数を再帰的に渡す
gist test
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext import db
import os
import random
import string
import time
#methods
def random_str():
require 'rubygems'
require 'tumblr'
require 'hatenabm'
require 'open-uri'
require 'rss'
require 'yaml'
##################
#read config
(puts "usage: tfav2httm.rb config-file";exit) if !ARGV[0]
config = YAML.load_file(ARGV[0])
"viとの互換モードをオフ
set nocompatible
"行数表示
set number
"エンコードetcを設定
set enc=utf-8
set fencs=iso-2022-jp,euc-jp,cp932
set ambiwidth=double
"検索に関する設定
require 'open-uri'
require 'rubygems'
require 'mechanize'
include WWW
def get_count(url)
agent = WWW::Mechanize.new
page = agent.get('http://b.hatena.ne.jp/entry/'+url)
page.at(".users").inner_text.gsub(/[^0-9]/,"").to_i
end