-
-
Save workmad3/9211061 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'commit_msg') | |
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'bundler' | |
gem 'pry' | |
gem 'pry-doc' | |
gem 'pry-byebug' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. git clone https://gist.github.com/workmad3/9211061.git | |
2. gem install bundler --no-ri --no-rdoc --user-install | |
3. bundle | |
4. rackup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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