Skip to content

Instantly share code, notes, and snippets.

@nus
nus / gist:1289855
Created October 15, 2011 17:13
HTMLParserを使ったページタイトルの取得
from HTMLParser import HTMLParser
import urllib2
class GetTitle(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.title_flag = False
def handle_starttag(self, tag, attrs):
if tag == 'title':
@nus
nus / make-web2py-for-fluxflex.sh
Created August 19, 2011 10:57
make web2py-for-fluxflex
#!/usr/bin/bash
mkdir web2py-for-fluxflex
cd web2py-for-fluxflex
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
rm web2py_src.zip
# Get web2py logo and rename web2py_logo.png.
@nus
nus / sleep_sort.cpp
Created May 19, 2011 23:59
Sleep sort
#include <iostream>
#include <boost/lexical_cast.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
using namespace std;
using namespace boost;
/*
@nus
nus / x-webkit-speech3.html
Created April 28, 2011 10:03
音声入力APIのテスト。イベント検知ができた
<html>
<head>
<meta charset="utf-8">
<title>x-webkit-speech test</title>
<script>
function speechInput() {
alert("changed");
}
</script>
</head>
@nus
nus / x-webkit-speech2.html
Created April 28, 2011 09:54
音声入力APIテスト。イベントリスナーを指定したけど呼ばれない。どうしてだ?
<html>
<head>
<meta charset="utf-8">
<title>x-webkit-speech test</title>
<script>
function onchange() {
alert("changed");
}
</script>
</head>
@nus
nus / x-webkit-speech.html
Created April 28, 2011 09:00
音声入力APIのテスト。GoogleChrome11から使えるようになったAPI。
<html>
<head>
<title>x-webkit-speech test</title>
</head>
<body>
<input type="text" x-webkit-speech />
</body>
</html>
@nus
nus / operate_table.html
Created March 29, 2011 13:06
Javascriptでtableを操作
<html>
<head>
<title>javascript table</title>
<script type="text/javascript">
function onload()
{
var table = document.getElementById("t");
for(var i = 0; i < 20; i++ ) {
var row = table.insertRow(-1);
@nus
nus / BoostAsioCommentGet.cpp
Created March 16, 2011 06:42
Boost::asioでニコ生のコメントを取得
#include <iostream>
#include <string>
#include <boost/asio.hpp>
using namespace std;
using namespace boost::asio;
int main()
{
/*
@nus
nus / gist:835920
Created February 20, 2011 11:51
CSS3で文字を動かす。Javascriptより簡潔に書ける。
<html>
<head>
<title>Hello PoinPoin!</title>
<style type="text/css">
@-webkit-keyframes PoinPoin {
50% {-webkit-transform: translate(0px, 80px);}
}
p {
-webkit-animation-name: PoinPoin;
-webkit-animation-duration: 2s;
@nus
nus / gist:835919
Created February 20, 2011 11:49
上下に文字が動く
<html>
<head>
<style type="text/css">
#test {
position: absolute;
top: 0px;
}
</style>
<script type="text/javascript">
var tid;