POST /uploads
- complete: default false
- chunk_size: default 1024*x
-> /uploads/id
- form PUT uploads/id/chunks/id
- list /uploads/id/chunks/id
PUT (repeat) GET to see what is missing
require 'base64' | |
class Zoidberg::Plugin::Auth | |
Zoidberg::Plugin.define :auth, self | |
def initialize(app) | |
app.generic_controller.send(:include, InstanceMethods) | |
end | |
module InstanceMethods |
require 'pathname' | |
module Storage | |
class Local | |
attr_reader :path | |
def initialize(path) | |
@path = Pathname(path).expand_path | |
end | |
def [](id) |
D, [2013-07-05T15:41:56.753944 #24121] DEBUG -- Asgard: GET /collections/ (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.46.5 (KHTML, like Gecko) Version/7.0 Safari/537.46.5) | |
D, [2013-07-05T15:41:56.754476 #24121] DEBUG -- Asgard: Rendering template collections/index.html | |
D, [2013-07-05T15:41:56.755479 #24121] DEBUG -- Asgard: Rendering layout layouts/application.html | |
E, [2013-07-05T15:41:56.756006 #24121] ERROR -- Asgard: Exception: Errno::EPIPE: Broken pipe | |
E, [2013-07-05T15:41:56.756179 #24121] ERROR -- Asgard: /usr/local/Cellar/ruby/HEAD/lib/ruby/gems/2.1.0/gems/zoid-0.0.0/lib/zoid/reactor/pure.rb:188:in `write_nonblock' | |
E, [2013-07-05T15:41:56.756239 #24121] ERROR -- Asgard: /usr/local/Cellar/ruby/HEAD/lib/ruby/gems/2.1.0/gems/zoid-0.0.0/lib/zoid/reactor/pure.rb:188:in `write_buffer' | |
E, [2013-07-05T15:41:56.756277 #24121] ERROR -- Asgard: /usr/local/Cellar/ruby/HEAD/lib/ruby/gems/2.1.0/gems/zoid-0.0.0/lib/zoid/reactor/pure.rb:206:in `write' | |
E, [2013-07-05T15:41:56.756325 #24121] ERROR |
require 'formula' | |
class Libvpx < Formula | |
homepage 'http://www.webmproject.org/code/' | |
url 'http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2' | |
sha1 '356af5f770c50cd021c60863203d8f30164f6021' | |
head 'http://git.chromium.org/webm/libvpx.git' | |
depends_on 'yasm' => :build |
#!/usr/bin/env ruby | |
require 'media' | |
$0 = '0.0' | |
converter = | |
Media.convert do | |
options y: true | |
input '/path/to/input.mov' |
require 'sequel' | |
DB = Sequel.sqlite | |
DB.create_table :collections do | |
primary_key :id | |
end | |
DB.create_table :items do | |
primary_key :id |
create_function(:notify, <<-SQL, language: :plpgsql, returns: :trigger, replace: true) | |
BEGIN | |
IF (TG_OP = 'DELETE') THEN | |
PERFORM pg_notify(TG_TABLE_NAME, '{ \"id\": \"' || OLD.id || '\", \"event\": \"' || TG_OP || '\" }'); | |
RETURN OLD; | |
ELSE | |
PERFORM pg_notify(TG_TABLE_NAME, '{ \"id\": \"' || NEW.id || '\", \"event\": \"' || TG_OP || '\" }'); | |
RETURN NEW; | |
END IF; | |
END; |
require 'sequel' | |
DB ||= Sequel.connect ENV['DATABASE_URL'] | |
class Resource < Sequel::Model | |
include Sequel.inflections | |
def after_save | |
db.notify channel | |
end |
POST /uploads
-> /uploads/id
PUT (repeat) GET to see what is missing
params = (url) -> | |
plus = /\+/g | |
search = /([^&=]+)=?([^&]*)/g | |
decode = (s) -> decodeURIComponent s.replace(plus, ' ') | |
index = url.indexOf '?' | |
if index isnt -1 then hash = url.substr index + 1 else hash = '' | |
result = {} | |
while match = search.exec(hash) |