Hi! Welcome...

Kolodvor Vlado Cingel is Rails developer from Croatia. Apart from Ruby & Rails, I really enjoy scripting in JavaScript and converting designs into great HTML & CSS.

01 August 2010 ~ 0 Comments

Number of workdays between two dates

It is pretty simple to get number of work days between two dates. For example we can get the number of workdays in this month.

  start_date = Date.civil(2010, 8, 1)
  end_date = Date.civil(2010, 8, 31)
  workdays = (start_date..end_date).select { |day| ![0, 6].include?(day.wday) }.size

[...]

05 July 2010 ~ 2 Comments

MarkItUp: Rails plugin that turns any textarea into a markup editor

I recently published a plugin that helps you turn any textarea into a markup editor. It is based on excellent markItUp! jQuery plugin.

Example

The most simple usage with preset defaults

<html>
<head>
  <%= javascript_include_tag "path/to/jquery" %>
  <%= mark_it_up '#miu_test' %>
</head>
<body>
  <% form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %>
</body>
</html>

You can see a lot more cool examples in action on markitup.cingel.hr.

More info

markitup.cingel.hr
github.com/cingel/mark_it_up

26 June 2010 ~ 0 Comments

Simple Search Rails plugin

SimpleSearch brings simple search to ActiveRecord. It ads simple_search named scope that accepts query as parameter.

The idea is that you provide the query and plugin does the rest (splits query to keywords and compose where statement).

This can be very useful in case you just want to filter list of records by some query, you have autocomplete field, … or something similar.

[...]

22 June 2010 ~ 0 Comments

Flood

IMG_0229

My neighbourhood was hit by flood today. We managed to prevent the water from entering the house, but it was a great reminder how powerful mother nature really is :)

[...]

25 February 2010 ~ 2 Comments

Create new app with specific Rails version

I recently installed Rails 3 beta release but I needed to create new app with the 2.3.5. version. I was searching for a way to do that and I found this

  rails _2.3.5_ appname

Unfortunately this will produce an error similar to this

  /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: railties(3.0.0.beta not = 2.3.5) (Gem::LoadError)
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:261:in `activate'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:68:in `gem'
	from /usr/local/bin/rails3:18

To fix this first run

[...]

Tags: , ,

12 February 2010 ~ 0 Comments

View man documentation in Preview

If you are on OSX you can easily open man documentation using Preview. Just replace ls with command you would like to see documentation for.

 man -t "ls" | open -f -a /Applications/Preview.app/

[...]

Tags: , , ,