Skip to content

Instantly share code, notes, and snippets.

View masui's full-sized avatar

Toshiyuki Masui masui

View GitHub Profile

Web時代のユーザインタフェース研究

@masui
masui / gist:8268798
Created January 5, 2014 14:26
予定表アクセスするCGIスクリプト
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'cgi'
cgi = CGI.new('html3')
time = Time.now
year = time.year
month = time.month
url = "http://Gyazz.com/masui/予定表 #{year}-#{month}"
@masui
masui / 時計の針
Last active December 29, 2015 19:19
def int(x)
x.to_i
end
def frac(x)
x.to_f - int(x)
end
def ts(x)
"#{x.to_i}時#{frac(x)*60.0}分"
@masui
masui / gist:5737708
Created June 9, 2013 04:53
画像を表示したり消したりを繰り返す
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>title</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<img id="img" src="http://gyazo.com/892d6b42a6a6db62ec368f90f0952984.png">
<script>
@masui
masui / test.c
Created April 8, 2013 02:35
report1
main(){
printf("hello");
}
@masui
masui / gist:5134566
Created March 11, 2013 14:20
memoコマンド ちょっとしたことをGyazzに登録するのに使う e.g. % memo 'ちょっとしたことを'
#!/usr/bin/ruby
require 'rubygems'
require 'gyazz'
title = ARGV[0]
if !title then
puts "% memo title"
exit
end
require 'rubygems'
require 'logger'
require 'active_record'
# ActiveRecord::Base.logger = Logger.new(STDERR)
# ActiveRecord::Base.colorize_logging = false
if File.exist?("3memo.sqlite3") then
File.delete("3memo.sqlite3")
end
(function($){
$.fn.test = function(){
this.on('mousedown',mousedownFunc(this));
this.name = "NAMENAME";
}
function mousedownFunc(obj){
return function(e){
alert(obj.name);
};
}
(function($){
$.fn.test = function(){
this.on('mousedown',mousedown);
this.name = "NAMENAME";
}
var mousedown = function(e){
// ここで this.name の値を知るにはどうする?
}
})(jQuery);
require "hondana"
include Hondana
shelf = Shelf.new('増井')
shelf.books.each { |book|
puts book.isbn
puts book.title
}