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
| 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 |
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
| alert("Hello! JavaScript") |
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
| def send(request): | |
| message = request.form.get("message") | |
| data = { | |
| "data": { | |
| "user": login_user.user.nickname(), | |
| "updated_at": str(datetime.datetime.now()), | |
| "message": message | |
| } | |
| } |
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
| 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) |
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
| // チェンネルインスタンスを生成 | |
| 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() { /* クローズ後のコールバック */ }; |
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
| 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]); |
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
| ;; | |
| ;; wordpress | |
| ;; | |
| (require 'weblogger) | |
| (global-set-key "\C-cbs" 'weblogger-start-entry) |
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
| $ cd ~/ | |
| $ mkdir ~/closure-sample | |
| $ cd ~/closure-sample | |
| $ ln -s /path/to/google-closure-library google-closure-library |
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> | |
| <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> |
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> | |
| <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> |
OlderNewer