This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create dummy object unless unsafeWindow is exists. | |
if (!unsafeWindow.console) { | |
unsafeWindow.console = { | |
log: function() {} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>test Js</title></head> | |
<script type="text/javascript"> | |
var dateTime = new Date(); | |
window.addEventListener("load", function() { | |
print('started on ' + dateTime.toDateString()); | |
print('hello test js'); | |
print('This is test template'); | |
}, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excel cvs file filter | |
# usage : ruby cvs_filter.rb input.csv column_no word | |
# | |
require "csv" | |
col_names = nil | |
CSV.open(ARGV[0], 'r') do |row| | |
unless col_names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<!-- My simple example source for jQuery --> | |
<head><title>test Js</title></head> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
log("loaded"); | |
$("#run").click(function() { | |
log("clicked"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Twitter をチラ見 (Simplest twitter reader) | |
*/ | |
CmdUtils.CreateCommand({ | |
name: "tirami-twitter", | |
preview: function(pblock){ | |
jQuery.get("http://twitter.com/statuses/friends_timeline.json", {count:15}, function(data){ | |
var messages = []; | |
messages.push("<div style='font-size:0.7em'>"); | |
for( var i = 0; i < data.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Debug log window | |
@see http://ajaxcookbook.org/javascript-debug-log/ | |
Usage: | |
log("message"); | |
*/ | |
function log(message) { | |
if (!log.window_ || log.window_.closed) { | |
var win = window.open("", null, "width=700,height=200," + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simplest twitter client (only for gets) | |
# twiget.rb | |
# usage: | |
# ruby twiget.rb 10 | |
# => friends timeline から 最新10件取得 | |
require 'net/http' | |
require 'kconv' | |
require 'rubygems' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simplest twitter client (only for posts) | |
require 'net/http' | |
require 'kconv' | |
require 'rubygems' | |
require 'snarl' | |
require 'json' | |
user = ARGV.shift | |
pass = ARGV.shift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# isbn13 -> 10 (ASIN) converter | |
module ISBNConverter | |
def conv_isbn13to10(isbn13) | |
return isbn13 if isbn13.length == 10 | |
validate(isbn13) | |
digits9 = digits(isbn13).join | |
last_digit = check_d(make_sum(digits(isbn13))).to_s | |
digits9 + last_digit |
OlderNewer