Thursday, May 17, 2012
Wooga started a little contest called EuRuKo Golf where you can win a ticket to EuRuKo 2012.
The goal of this contest is to write a tweetable (140 characters or less) ruby program that outputs EuRoKo ASCII art.
One of the smartest solutions was Matteo’s (see pull request https://github.com/wooga/euruko-golf/pull/2) which uses the artii gem to create ASCII art.
A drawback of this solution is that you should have the artii gem installed on your system to run it without errors. A workaround solution is to call a web service which uses a sort of artii gem to generate ASCII art from a string.
This solution is now available thanks to ASCII art API.
It’s a simple Goliath app that lets you generate ASCII art from any text.
Try http://artii.herokuapp.com/make?text=I+love+ASCII+art, you should see something like this as a response from the API:
_____ _ _____ _____ _____ _____ _
|_ _| | | /\ / ____|/ ____|_ _|_ _| | |
| | | | _____ _____ / \ | (___ | | | | | | __ _ _ __| |_
| | | |/ _ \ \ / / _ \ / /\ \ \___ \| | | | | | / _` | '__| __|
_| |_ | | (_) \ V / __/ / ____ \ ____) | |____ _| |_ _| |_ | (_| | | | |_
|_____| |_|\___/ \_/ \___| /_/ \_\_____/ \_____|_____|_____| \__,_|_| \__|
With this API you should be able to build a solution to the contest like this:
require 'open-uri'
puts open('http://j.mp/IRG0u1').read
You can find app’s source code at http://github.com/potomak/artii-api.
Resources:
EuRuKo Golf by Wooga
EuRuKo Golf repo
Monday, March 12, 2012
Heroku is a great PaaS, it let you deploy an app in seconds, almost everything is automated. By default your app will use Heroku shared database, a Postgres db instance which is a perfect choice for development environments but you just can’t use it in production (just take a look at Heroku status blog to get an idea).
A cheap alternative is Amazon Relational Database Service (RDS). It offers MySQL instances at competitive prices.
To make this service available to your Heroku application you should create a new database instance at Amazon RDS and then enable this resource by adding the relative add-on.
Keep in mind that Heroku dynos are Amazon EC2 instances and should be situated in US-East zone so making a RDS instance in the same zone leads to an optimal communication speed between app server and db server.
Step 1
Create an RDS database instance, you can do it using web based Amazon RDS console.
Step 2
Migrate your data from Heroku shared database to your new Amazon RDS database instance.
You’ll need to aythorize access to the RDS instance from your workstation running:
$ rds-authorize-db-security-group-ingress default --cidr-ip 1.1.1.1/32
where 1.1.1.1/32 is your public IP subnet.
Now you can use taps to pull from your Heroku database to your RDS database:
$ heroku db:pull mysql://user:pass@rdshostname.amazonaws.com/databasename
Step 3
Authorize Heroku app access to RDS database
$ rds-authorize-db-security-group-ingress --db-security-group-name default \
--ec2-security-group-name default \
--ec2-security-group-owner-id 098166147350 \
--aws-credential-file ../credential-file-path.template
Step 4
Add Amazon RDS Heroku add-on
$ heroku addons:add amazon_rds url=mysql2://user:pass@rdshostname.amazonaws.com/databasename
That’s all.
Notes
If you get Taps Load Error: no such file to load -- taps/operation error at “Step 2” no worries, just install taps on your system by running
$ gem install taps
and retry.
Remember also to update your app’s Gemfile configuration to load mysql2 gem instead of pg changing from
gem 'pg'
to
gem 'mysql2'
Resources:
Amazon RDS
Heroku Dev Center - Amazon RDS
Wednesday, December 07, 2011
You need A feature and you know how to make it by extending B, an open source project repo hosted on GitHub.
You first should fork B repo, edit, test and commit your changes.
Than you send your pull request and you’re done.
After some inactivity on your fork your local repo is outdated, how can you update your fork getting code from the main repo?
-
Add upstream remote to track main repo
$ git remote add upstream git://github.com/octocat/Spoon-Knife.git
-
Fetch upstream remote in your local repo
$ git fetch upstream
-
Merge upstream/master in your current branch to apply updates
$ git merge upstream/master
Resources:
GitHub Help - Fork a repo