Skip to content

Instantly share code, notes, and snippets.

Created Apr 1, 2016

What would you like to do?
RethinkDB application built with Dogescript
<!DOCTYPE html>
<title>Skyla's DogeScript demo</title>
<script src="/"></script>
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>
body {
font-family: sans-serif;
.message img {
width: 300px;
.message {
margin-top: 15px;
#input-area {
margin-top: 25px;
<div id="messages">
<div id="input-area">
<input id="message" type="text" placeholder="enter message here">
<script id="message-template" type="text/x-handlebars-template">
<div class="message">
<div class="user">{{name}}:</div>
<div class="message">
<img src="{{message}}.png?split=false"
<script src="/wowindex.js"></script>
so rethinkdbdash
so express
so as sockio
so http
so body-parser as bodyParser
very r is plz rethinkdbdash
very app is plz express
very server is plz http.Server with app
very io is plz sockio with server
very static is plz express.static with 'public'
plz app.use with static
plz app.use with bodyParser.json()
very makeTable is plz r.tableCreate with 'dogechat'
plz r.tableList&
dose contains with 'dogechat'&
dose not&
dose and with makeTable&
dose then with much
very query is plz r.table with 'dogechat'&
dose changes
wow& query
dose then with much feed
plz feed.each with much err change
plz io.sockets.emit with 'message' change.new_val
plz app.get with '/api/fetch' much req res
plz r.table with 'dogechat'&
dose orderBy with r.desc('time')&
dose limit with 5&
dose then with much output
plz res.send with output
plz with '/api/send' much req res
very doc is {,message:req.body.message,}
plz r.table with 'dogechat'&
dose insert with doc&
dose then with much output
plz res.send with output
plz server.listen with 8000
very template is plz Handlebars.compile with $("#message-template").html()
plz io&
dose on with 'message' addMessage
such addMessage much message
very content is plz template with message
plz $("#messages").append with content
such sendMessage much name text
very doc is plz JSON.stringify with {name: name, message: text}
very head is {'Content-Type':'application/json','Accept':'application/json'}
plz fetch with '/api/send' {method: 'POST', headers: head, body: doc}&
dose then with much output
plz console.loge output
very username is plz prompt with 'Please enter your username'
plz fetch with '/api/fetch'&
dose then with much res
wow& res.json()
dose then with much output
plz with addMessage
plz $("#message").keyup with much e
rly e.keyCode is 13
plz sendMessage with username is ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.