I hereby claim:
- I am mdlawson on github.
- I am mdlawson (https://keybase.io/mdlawson) on keybase.
- I have a public key whose fingerprint is 0DF6 B13E D6E7 CD09 285F 9EB8 8B90 A4DF E816 05A1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
send: (message,id) -> | |
$http.post(APIURL+"addUserMessage", | |
#userIdFrom: User.id | |
userIdTo: id | |
message: message | |
).success (data) -> | |
console.log "send message",message,"to",toId | |
markRead: (id) -> | |
$http.post(APIURL+"markRead", | |
userIdFrom: id |
var express = require('express'); | |
var facebook = require('connect-facebook-session'); | |
var app = express(); | |
app.configure(function () { | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser()); | |
app.use(express.session({ secret: 'foo bar' })); | |
app.use(facebook({ |
fs = require "fs" | |
os = require "os" | |
{exec} = require "child_process" | |
HOSTS = if os.platform() is "win32" then "C:\\Windows\\System32\\Drivers\\etc\\hosts" else "/etc/hosts" | |
hosts = (name,read,write) -> | |
entry = -1 | |
exit = -1 |
<head> | |
<title>Grassington Town Hall</title> | |
<%= javascript_include_tag "jquery-latest", :media => "all" %> | |
<%= javascript_include_tag "bootstrap", :media => "all" %> | |
<%= stylesheet_link_tag "bootstrap", :media => "all" %> | |
<%= stylesheet_link_tag "application", :media => "all" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<div class="navbar navbar-static-top"> |
Useful stuff
Routing: we need to make routes that take people to games. To do this we can use URL slugs, eg:
/game/200
express allows us to create routes that work like this by using :
in the route. eg
app.get("/game/:id", function(req,res){
res.send("This is game id " + req.params.id);
class Factory | |
constructor: (options) -> | |
@hanger = [] | |
@entity = options.entity or Rogue.Entity | |
@opts = options.options or {} | |
@initial = options.initial | |
for i in [0...@initial] | |
@hanger.push @build() | |
deploy: (num) -> |
task 'doc', 'Build docs', -> | |
fs = require 'fs' | |
dox = require '../dox' | |
jade = require 'jade' | |
fs.readFile 'doc/template.jade', 'utf-8', (err,tmpl) -> | |
fn = jade.compile tmpl | |
for file in files | |
code =fs.readFileSync "src/#{file}.coffee", 'utf-8' | |
json = dox.parseComments code | |
html = fn({"dox":json,"file":file}) |
state = require 'state' | |
game = new Rogue.Game | |
fps: true | |
game.input = new Rogue.Keyboard game.canvas | |
game.mouse = new Rogue.Mouse game | |
game.assets = assets = new Rogue.AssetManager | |
baseUrl: "" | |
packs: | |
core: [ |
function doGet(e) { | |
var response = UrlFetchApp.fetch("https://" + SLACK_TEAM_NAME + ".slack.com/api/users.admin.invite", { | |
"method" : "post", | |
"payload": { | |
"token": SLACK_API_TOKEN, | |
"set_active": "true", | |
"email": Session.getActiveUser().getEmail(), | |
} | |
}); | |
var result = JSON.parse(response.getContentText()); |