This file contains 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
class WebSocketHandler(tornado.websocket.WebSocketHandler): | |
_PING_INTERVAL = 3.0 | |
_DISCONNECT_TIMEOUT = 10.0 | |
connections = set() | |
button = Button() | |
def open(self): | |
self.id = self.get_argument("id") | |
WebSocketHandler.connections.add(self) |
This file contains 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
package main | |
import "github.com/go-martini/martini" | |
func main() { | |
m := martini.Classic() | |
m.Get("/", func() string { | |
return "Hello world!" | |
}) | |
m.Run() |
This file contains 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
-- +goose Up | |
CREATE TABLE photos ( | |
id uuid primary key default uuid_generate_v4() NOT NULL, | |
reel_id uuid NOT NULL REFERENCES reels(id), | |
path text NOT NULL, | |
thumbnail text, | |
bytes bigint NOT NULL, | |
rev text NOT NULL, | |
exif text, | |
cleaned boolean NOT NULL default false, |
This file contains 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
package controllers | |
import ( | |
"net/http" | |
"github.com/go-martini/martini" | |
"github.com/jinzhu/gorm" | |
"github.com/martini-contrib/render" | |
. "github.com/madebymany/riru/models" |
This file contains 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
package models | |
import ( | |
"time" | |
) | |
type Reel struct { | |
ID string `json:"id"` | |
Name string `json:"name"` | |
Folder string `json:"folder"` |
This file contains 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
-- +goose Up | |
CREATE TABLE reels ( | |
id uuid primary key default uuid_generate_v4() NOT NULL, | |
name text NOT NULL, | |
folder text NOT NULL, | |
auth_provider_id uuid NOT NULL REFERENCES auth_providers(id), | |
owner_id uuid NOT NULL REFERENCES users(id), | |
updated_at timestamp NOT NULL default now(), | |
created_at timestamp NOT NULL default now() |
This file contains 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
package controllers | |
import ( | |
"encoding/json" | |
"io" | |
"net/http" | |
"github.com/go-martini/martini" | |
"github.com/jinzhu/gorm" | |
"github.com/jrallison/go-workers" |
This file contains 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
package app | |
import ( | |
"github.com/go-martini/martini" | |
"github.com/jinzhu/gorm" | |
"github.com/kylelemons/go-gypsy/yaml" | |
_ "github.com/lib/pq" | |
"github.com/martini-contrib/render" | |
"github.com/martini-contrib/secure" | |
"github.com/martini-contrib/sessions" |
This file contains 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
func AuthenticateUser(session sessions.Session, db gorm.DB, c martini.Context, r render.Render) { | |
user := FetchUser(session, db) | |
if user.ID != "" { | |
c.Map(user) | |
return | |
} | |
r.Error(http.StatusUnauthorized) | |
} |
This file contains 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
run: | |
goose -env=development up | |
go run main.go | |
resetdb: | |
dropdb riru-dev | |
createdb riru-dev | |
goose up | |
test: |
OlderNewer