Skip to content

Instantly share code, notes, and snippets.

View kamito's full-sized avatar

Shinichirow KAMITO kamito

  • Groovenauts, Inc.
  • Japan
View GitHub Profile
BLACK => "\033[30m",
RED => "\033[31m",
GREEN => "\033[32m",
YELLOW => "\033[33m",
BLUE => "\033[34m",
PURPLE => "\033[35m",
CYAN => "\033[36m",
WHITE => "\033[37m",
# background color
alert("Hello! JavaScript")
def send(request):
message = request.form.get("message")
data = {
"data": {
"user": login_user.user.nickname(),
"updated_at": str(datetime.datetime.now()),
"message": message
}
}
def index(request):
client_id = users.get_current_user()
token = channel.create_channel(client_id)
template_value = {
"token": token
}
return render_to_response('gtug0/root/index.html', template_value)
// チェンネルインスタンスを生成
var channel = new goog.appengine.Channel(window.channel_token);
// チェンネルをオープン
var socket = this.channel.open();
// 各コールバック関数をセット
socket.onopen = function() { /* オープン後のコールバック */ };
socket.onmessage = function() { /* メッセージを受け取ったときののコールバック */ };
socket.onerror = function() { /* エラーが発生したときのコールバック */ };
socket.onclose = function() { /* クローズ後のコールバック */ };
socket.onmessage = function(response) {
var data = response.data;
var name_txt = data.user + " : ";
var message_txt = data.message + " (" + data.updated_at + ")";
var tbody = goog.dom.getElement("messages");
var th_name = goog.dom.createDom("th", {style:"text-align:right;"}, name_txt);
var td_message = goog.dom.createDom("td", {}, message_txt);
var tr = goog.dom.createDom("tr", {}, [th_name, td_message]);
tbody.insertBefore(tr, tbody.childNodes[0]);
;;
;; wordpress
;;
(require 'weblogger)
(global-set-key "\C-cbs" 'weblogger-start-entry)
$ cd ~/
$ mkdir ~/closure-sample
$ cd ~/closure-sample
$ ln -s /path/to/google-closure-library google-closure-library
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>416.bz: Google Closure Library Sample</title>
</head>
<body>
<h1>416.bz: Google Closure Library Sample</h1>
<div id="content"></div>
<div id="buttons"></div>
</body>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>416.bz: Google Closure Library Sample</title>
<!--// common.cssを読み込む //-->
<link rel="stylesheet" type="text/css" href="google-closure-library/closure/goog/css/common.css" />
</head>
<body>
<h1>416.bz: Google Closure Library Sample</h1>
<div id="content"></div>