Skip to content

wolfd/gifmachine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gifmachine

A Machine for Gifs

  • Need an excuse to show a gif to your coworkers?
  • Need a use for that Raspberry Pi that isn't doing anything useful?
  • Need a web-scale solution to your animated gif needs?

Presenting the newest GMaaS (Gif Machine as a Service) solution for your tech company with a startup culture: gifmachine

billion dollar startup idea

What actually is it?

  • gifmachine is a Ruby Sinatra app that provides a dirty interface for enjoying gifs with your coworkers. gifmachine provides a HTTP API for posting gifs and meme text to overlay.
  • gifmachine allows your coworkers to complain about company_x's broken API when it goes down and laugh as the internet catches fire.
  • gifmachine is designed to be run in kiosk mode on an unused computer and monitor, it's just a webpage that puts the gif meme in fullscreen.

How does it work?

It mostly does! When it is working well...

  • gifmachine uses WebSockets to send out updates to connected clients.
  • gifmachine stores everything in a database (developed with Postgres, but it shouldn't be too hard to change that).
  • gifmachine uses ActiveRecord to save the developer time and calories.

WebSockets?

websockets are magic

Okay I want this, what do?

  1. Get RVM
  2. Using RVM, install Ruby 2.1.2 rvm install 2.1.2
  3. Run bundle install
  4. Get Postgres 9.1 or newer sudo apt-get install postgresql postgresql-contrib
  5. If using Ubuntu Server 14.04 you might need to install libpq-dev for bundler to work
  6. sudo -u postgres createuser -D -A -P gifmachine and enter in a good password
  7. sudo -u postgres createdb -O gifmachine gifmachine
  8. Change config/database.yml to reflect the username and password of your gifmachine database
  9. Set your RACK_ENV (e.g. export RACK_ENV='development')
  10. rake db:schema:load to load the database schema into the database
  11. Change the API password (:gifmachine_password) in app.rb to something else
  12. rackup
  13. Enjoy.

Uh, how do I post gifs?

Here's a relevant snippet of Ruby code that might help you interface with gifmachine's API:

EventMachine::HttpRequest.new("#{@config.base_url}/gif", options).post :body => {
  :url => gif_url,
  :who => username,
  :meme_top => meme_top,
  :meme_bottom => meme_bottom,
  :seekrit => @config.password # Minimal security lololol
}

Alternatively, here's a simple curl:

curl --data 'url=http://www.example.com/somegif.gif&who=thatAmazingPerson&meme_top=herp&meme_bottom=derp&seekrit=yourSuperSecretPasswordFromAppRb' 'http://yourGifMachineUrl/gif'