Skip to content

Instantly share code, notes, and snippets.

View tana's full-sized avatar

Satoshi Tanaka tana

View GitHub Profile
import flash.external.ExternalInterface;
import flash.text.TextField;
class External {
static var tf : TextField;
static var count = 0;
static function main() {
tf = new TextField();
tf.text = Std.string(count);
flash.Lib.current.addChild(tf);
ExternalInterface.addCallback("increment", increment);
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.URLRequest;
import flash.text.TextField;
class SoundPlayer {
static function main() {
var text = "Hello";
var url = "http://translate.google.com/translate_tts?tl=en&q=" + StringTools.urlEncode(text);
var snd = new Sound(new URLRequest(url));
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
class Speak {
static var channel : SoundChannel;
static var status : Bool = false; //再生中はtrue。再生が終わるとfalseになる。
#include <stdio.h>
#define print(str) main(){printf(str);}
print("hello\n");
#include <stdio.h>
struct Hoge {
int num;
};
struct Aaaaa {
struct Hoge hoge;
int n;
};
(use srfi-1)
(use util.match)
(define (split-patterns l)
(let* ((rest (car l)) (pats (cadr l)) (pos (list-index (pa$ eq? '->) rest)))
(if (not (eq? pos #f))
(split-patterns (cons (drop rest (+ pos 2))
(list (append pats (list (take rest (+ pos 2)))))))
pats)))
<html>
<head>
<title>認証ページ</title>
<style>
input {
top: 10px; left: 10px; position: absolute;
width: 50px; height: 30px;
}
</style>
</head>
@tana
tana / mikutter_size_reset.rb
Created November 5, 2010 12:51
mikutterのウィンドウサイズの設定をリセットするスクリプト。
require 'pstore'
db = PStore.new("#{ENV['HOME']}/.mikutter/p_class_values.db")
db.transaction do
db.delete("Plugin::GUI::size")
end
@tana
tana / orz.rb
Created March 13, 2011 11:48
使い方: 「ruby orz.rb」または「ruby orz.rb -s」
require 'curses'
$mode = ARGV[0] == "-s"
class Orz
def initialize(x, y)
@x = x
@y = y
end
attr_accessor :x, :y
end
@tana
tana / orz2.rb
Created March 22, 2011 15:43
orzなスクリプト
require 'curses'
to_o_pos = [[3, 2], [4, 2], [5, 2], [2, 3], [6, 3], [2, 4], [6, 4], [2, 5], [6, 5], [3, 6], [4, 6], [5, 6]]
to_r_pos = [[9, 2], [12, 2], [13, 2], [9, 3], [11, 3], [9, 4], [10, 4], [9, 5], [9, 6]]
to_z_pos = [[16, 2], [17, 2], [18, 2], [19, 2], [20, 2], [19, 3], [18, 4], [17, 5], [16, 6], [17, 6], [18, 6], [19, 6], [20, 6]]
def make_rand_pos_arr(count)
arr = []
count.times {
arr << [rand(21), rand(9)]