Skip to content

Instantly share code, notes, and snippets.

@workmad3
Forked from markfeedly/commit_msg.rb
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save workmad3/9211061 to your computer and use it in GitHub Desktop.
Save workmad3/9211061 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'pry'
require 'open-uri'
get '/' do
erb :index
end
get '/commit' do
@result = open('http://whatthecommit.com/index.txt').read
erb :commit
end
get '/pry' do
# Play with pry here
binding.pry
erb :index
end
__END__
@@ index
<!DOCTYPE html>
<html>
<head>
<title>Your services</title>
</head>
<body>
<ul>
<li><a href='/commit'>Commit Message Generator</a></li>
</ul>
</body>
</html>
@@ commit
<!DOCTYPE html>
<html>
<head>
<title>Your commit message</title>
<link href='http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' rel='stylesheet'>
<script src='http://code.jquery.com/jquery-2.1.0.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/zclip/1.1.2/jquery.zclip.min.js'></script>
<script src='http://hedtek.com/jquery.zclip.html5.js'></script>
</head>
<body>
<p id='commit-message'><%= @result %></p>
<a href=''><i class='fa fa-refresh fa-2x fa-spin'></i></a>
|
<a href='#' data-clipboard data-clipboard-target="#commit-message"><i class='fa fa-copy fa-2x'></i></a>
|
<a href='/'><i class='fa fa-home fa-2x'></i>
</body>
</html>
require File.join(File.dirname(__FILE__), 'commit_msg')
run Sinatra::Application
source 'https://rubygems.org'
gem 'sinatra'
gem 'bundler'
gem 'pry'
gem 'pry-doc'
gem 'pry-byebug'
1. git clone https://gist.github.com/workmad3/9211061.git
2. gem install bundler --no-ri --no-rdoc --user-install
3. bundle
4. rackup
Things to consider
1. Add more services (find interesting ones, integrate)
2. Use a sinatra layout to neaten up the templates
3. Add some extra styling (e.g. with bootstrap or zurb foundation frameworks)
4. Get the application hosted on heroku
5. Do other fun stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment