public
Last active

Sinatra app for saving links to Backpack

  • Download Gist
backpack_it.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
require 'rubygems'
require 'sinatra'
require 'rest_client'
require 'pismo'
 
set :api_key, 'your api key for backpack goes here'
set :backpack_page, 'the backpack pages api you are saving to goes here'
 
get '/backpackit/*' do
url = params[:splat].first
doc = Pismo::Document.new(url)
title = '"' + doc.html_title + '":' + url
RestClient.post(settings.api_key,
{
:token => settings.backpack_page,
:note => { :title => title }
})
redirect url
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.