Pages - Menu

Sunday, February 24, 2013

Forgot to add files and made a commit?

It happens to me frequently, I make a commit and just after that I remember that there are some files that I left behind.

The solution is pretty simple: amend

git commit --amend -C HEAD

The detail is that you can use it with -C or -c (I hope you noticed the capital).

The -C uses the last commit message and author stuff and commit again but with your forgotten files.

The -c will let you set a new message.

Easy breezy.

Be happy.

Tuesday, February 19, 2013

Rails errors with Foundation style with simple_form

I just made my error messages use Foundation styles  (http://foundation.zurb.com/docs/forms.php, scroll until Error States)

I edited the simple_form initializer:



Now you have cool error/alert/whatever messages.

Be happy

Friday, February 15, 2013

RSpec or UnitTest

I asked that myself 5 minutes ago and wasted 3 searching and guess what, 50% votes for RSpec and the other half to UnitTest. So, based on this "in depth" research, I came up with the solution.

I doesn't matter at all, choose that one that reads cleaner. It's like asking: "What is the best editor?"

Tuesday, February 12, 2013

Foundation fonts not working

I just made my application work with Foundation Fonts. It is simple but not obvious if you follow the step-by-step.

Acabei de fazer minha aplicação usar as fontes do , é bem simples mas não tão óbvio se você seguir o

They say it is simple like adding a bit of code, of course you need to make some changes.



I won't work.

I made some tests, read some stackoverflow answers and nothing...

Just to make sure the problem wasn't with assets pipeline I printed this in my console:

p Rails.application.config.assets.paths

Guess what. My fonts path was there.

/app/assets/fonts so I was sure there problem was my CSS

That's when I checked the downloaded file from Zurb and the one from the page and notice the difference.



See? There are some classes references to each icon so it's not just adding those i tags and you're done.

In case you need a CSS with all fonts, I have a gist for you

Be happy!

Thursday, January 31, 2013

Github: I've created a small bash script to help with git projects

Hello world!

I have create a small bash script to open the git project page from terminal with some options.

https://github.com/gerep/opengit

And if someday you think "it would be great if...", just tell me and I'll be glad to try that =)

Monday, January 28, 2013

Testing different database connections

Hello world!

I had to test some database connections from inside my application.

The user fill a form with the required information but before saving it to my PostgreSQL instance I had to check if everything is OK.

I was trying to use my model like this:


And guess what, as expected it replaces my application connection.

The solution is pretty simple, use the adapter class like:


The reason for this code be inside a bedin/rescue is that if anything is wrong with the connection data it will return 500 Internal Server Error

Problem solved.

Friday, November 2, 2012

Another way to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName"

Hi fellas!

Don't know why but even with the httdp.conf file configured I was still receiving the error: "Could not realiably...", checked the /etc/hosts and everything was OK.

The solution is pretty simple, just rename the http.conf to fqdn and move it to the conf.d folder

Problem solved.

Adios!