├── views ├── nopaste.haml ├── pasted.haml ├── paste.haml ├── index.haml ├── layout.haml └── .bundle │ └── install.log ├── config.ru ├── public ├── BOARDER.ttf └── style.css ├── Gemfile ├── .gitignore ├── Gemfile.lock └── app.rb /views/nopaste.haml: -------------------------------------------------------------------------------- 1 | %p 2 | Couldn't find it dog 3 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require './app' 2 | run Sinatra::Application 3 | -------------------------------------------------------------------------------- /public/BOARDER.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i/clipboar/master/public/BOARDER.ttf -------------------------------------------------------------------------------- /views/pasted.haml: -------------------------------------------------------------------------------- 1 | %input.url{type: 'text', onclick: 'this.select()', value: @url} 2 | -------------------------------------------------------------------------------- /views/paste.haml: -------------------------------------------------------------------------------- 1 | %p 2 | Here it is dog: 3 | 4 | %p 5 | %textarea.tbox{readonly: true, onclick: 'this.select()'} 6 | = @buf 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'mongo', :git => 'git://github.com/mongodb/mongo-ruby-driver.git' 4 | gem 'bson_ext' 5 | gem 'sinatra' 6 | gem 'haml' 7 | -------------------------------------------------------------------------------- /views/index.haml: -------------------------------------------------------------------------------- 1 | %form{ action: '/', method: 'post' } 2 | %p 3 | %textarea.tbox{ name: 'content', placeholder: 'paste it here...', autofocus: true} 4 | %p 5 | %input{type: 'text', name: 'name', placeholder: 'title (optional)' } 6 | %p 7 | %input{ type: 'submit', value: 'submit' } 8 | -------------------------------------------------------------------------------- /public/style.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: boar; 3 | font-size: 36; 4 | src: url(BOARDER.ttf); 5 | } 6 | 7 | img.boar { 8 | width: 20%; 9 | } 10 | 11 | .container { 12 | text-align: center; 13 | } 14 | 15 | textarea.tbox { 16 | width: 50%; 17 | height: 200px; 18 | resize: none; 19 | } 20 | 21 | .container { 22 | font-family: boar; 23 | } 24 | -------------------------------------------------------------------------------- /views/layout.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | 3 | %html 4 | %head 5 | %title Clipboar 6 | %link{:type => "text/css", :rel => "stylesheet", :href => "/style.css"} 7 | 8 | %body 9 | .container 10 | %h1 clipboar 11 | %p Self destructing pastes 12 | %p 13 | %img.boar{src: 'http://bestclipartblog.com/clipart-pics/boar-clip-art-1.png'} 14 | =yield 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | *.sassc 3 | .sass-cache 4 | capybara-*.html 5 | .rspec 6 | .rvmrc 7 | /.bundle 8 | /vendor/bundle 9 | /log/* 10 | /tmp/* 11 | /db/*.sqlite3 12 | /public/system/* 13 | /coverage/ 14 | /spec/tmp/* 15 | clips/* 16 | **.orig 17 | rerun.txt 18 | pickle-email-*.html 19 | .project 20 | .DS_Store 21 | .AppleDouble 22 | .LSOverride 23 | Icon 24 | 25 | 26 | # Thumbnails 27 | ._* 28 | 29 | # Files that might appear on external disk 30 | .Spotlight-V100 31 | .Trashes 32 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/mongodb/mongo-ruby-driver.git 3 | revision: cf836bcf81279c66751acf4bfe70c5f660adf759 4 | specs: 5 | mongo (3.0.0.alpha) 6 | bson (~> 2.2) 7 | 8 | GEM 9 | remote: https://rubygems.org/ 10 | specs: 11 | bson (2.2.4) 12 | bson_ext (1.5.1) 13 | haml (4.0.5) 14 | tilt 15 | rack (1.5.2) 16 | rack-protection (1.5.3) 17 | rack 18 | sinatra (1.4.5) 19 | rack (~> 1.4) 20 | rack-protection (~> 1.4) 21 | tilt (~> 1.3, >= 1.3.4) 22 | tilt (1.4.1) 23 | 24 | PLATFORMS 25 | ruby 26 | 27 | DEPENDENCIES 28 | bson_ext 29 | haml 30 | mongo! 31 | sinatra 32 | -------------------------------------------------------------------------------- /app.rb: -------------------------------------------------------------------------------- 1 | require 'sinatra' 2 | require 'sinatra/reloader' 3 | require 'haml' 4 | 5 | get '/' do 6 | haml :index 7 | end 8 | 9 | post '/' do 10 | doc = params['content'] 11 | name = params['name'].empty?? doc.hash.to_s : params['name'] 12 | 13 | while File.exists? "clips/#{name}" do 14 | name = name.hash.to_s 15 | end 16 | 17 | return haml :index if name.match '/' 18 | 19 | begin 20 | File.open("clips/#{name}", 'w') { |f| f.write(doc) } 21 | @url = "http://clipboar.org/#{name}" 22 | haml :pasted 23 | rescue 24 | haml :index 25 | end 26 | end 27 | 28 | get '/:id' do 29 | path = "clips/#{params['id']}" 30 | if File.exists?(path) 31 | @buf = File.open(path) { |f| f.read } 32 | File.delete(path) if not request.env['HTTP_USER_AGENT'].match 'facebook' 33 | haml :paste 34 | else 35 | haml :nopaste 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /views/.bundle/install.log: -------------------------------------------------------------------------------- 1 | # Logfile created on 2014-05-21 22:17:07 -0400 by logger.rb/44203 2 | I, [2014-05-21T22:17:07.943532 #7293] INFO -- : 0: bson (2.2.4) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/bson-2.2.4.gemspec 3 | I, [2014-05-21T22:17:07.944043 #7293] INFO -- : 0: tilt (1.4.1) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/tilt-1.4.1.gemspec 4 | I, [2014-05-21T22:17:07.944399 #7293] INFO -- : 0: haml (4.0.5) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/haml-4.0.5.gemspec 5 | I, [2014-05-21T22:17:08.039569 #7293] INFO -- : 0: mongo (3.0.0.alpha) from /home/ian/.rvm/gems/ruby-2.1.0/bundler/gems/mongo-ruby-driver-cf836bcf8127/mongo.gemspec 6 | I, [2014-05-21T22:17:08.040086 #7293] INFO -- : 0: rack (1.5.2) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/rack-1.5.2.gemspec 7 | I, [2014-05-21T22:17:08.772948 #7293] INFO -- : 0: rack-protection (1.5.3) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/rack-protection-1.5.3.gemspec 8 | I, [2014-05-21T22:17:09.845303 #7293] INFO -- : 0: sinatra (1.4.5) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/sinatra-1.4.5.gemspec 9 | I, [2014-05-21T22:17:09.846241 #7293] INFO -- : 0: bundler (1.5.0) from /home/ian/.rvm/gems/ruby-2.1.0@global/specifications/bundler-1.5.0.gemspec 10 | I, [2014-05-21T22:18:11.267518 #7366] INFO -- : 0: bson (2.2.4) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/bson-2.2.4.gemspec 11 | I, [2014-05-21T22:18:13.382918 #7366] INFO -- : 0: bson_ext (1.5.1) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/bson_ext-1.5.1.gemspec 12 | I, [2014-05-21T22:18:13.383952 #7366] INFO -- : 0: tilt (1.4.1) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/tilt-1.4.1.gemspec 13 | I, [2014-05-21T22:18:13.384664 #7366] INFO -- : 0: haml (4.0.5) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/haml-4.0.5.gemspec 14 | I, [2014-05-21T22:18:13.484947 #7366] INFO -- : 0: mongo (3.0.0.alpha) from /home/ian/.rvm/gems/ruby-2.1.0/bundler/gems/mongo-ruby-driver-cf836bcf8127/mongo.gemspec 15 | I, [2014-05-21T22:18:13.485558 #7366] INFO -- : 0: rack (1.5.2) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/rack-1.5.2.gemspec 16 | I, [2014-05-21T22:18:13.485875 #7366] INFO -- : 0: rack-protection (1.5.3) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/rack-protection-1.5.3.gemspec 17 | I, [2014-05-21T22:18:13.486179 #7366] INFO -- : 0: sinatra (1.4.5) from /home/ian/.rvm/gems/ruby-2.1.0/specifications/sinatra-1.4.5.gemspec 18 | I, [2014-05-21T22:18:13.486479 #7366] INFO -- : 0: bundler (1.5.0) from /home/ian/.rvm/gems/ruby-2.1.0@global/specifications/bundler-1.5.0.gemspec 19 | --------------------------------------------------------------------------------