Skip to content

Instantly share code, notes, and snippets.

View rderoldan1's full-sized avatar
🇨🇴

Ruben Espinosa rderoldan1

🇨🇴
  • Medellin, Colombia
View GitHub Profile
def export
selected = params[:select_export][:id]
fecha_corte = params[:fecha_corte_tf]
if(%w(2 3 4).include?(selected)) && (fecha_corte.eql? "")) && (fecha_corte.eql? "")
redirect_to :back, :alert => "Seleccione una fecha de corte"
else
respond_to do |format|
format.csv do
@rderoldan1
rderoldan1 / gallery.coffee
Created September 9, 2013 15:28
Simple photo gallery
@rderoldan1
rderoldan1 / desable.coffee
Created September 1, 2013 22:33
Disable all options if readonly class is present
$('select.readonly option:not(:selected)').attr('disabled',true)
@rderoldan1
rderoldan1 / rdoc.css
Last active December 22, 2015 01:29
css for rdoc, code syntax like github
/*
* "Darkfish" Rdoc CSS
* $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $
*
* Author: Michael Granger <ged@FaerieMUD.org>
* Edited: Ruben Espinosa <rderoldan1@gmail.com>
*
*/
/* Base Green is: #6C8C22 */
@rderoldan1
rderoldan1 / migration.rb
Created August 5, 2013 06:32
Rails number db format
t.integer :int # int (4 bytes, max 2,147,483,647)
t.integer :int1, :limit => 1 # tinyint (1 byte, -128 to 127)
t.integer :int2, :limit => 2 # smallint (2 bytes, max 32,767)
t.integer :int3, :limit => 3 # mediumint (3 bytes, max 8,388,607)
t.integer :int4, :limit => 4 # int (4 bytes)
t.integer :int5, :limit => 5 # bigint (8 bytes, max 9,223,372,036,854,775,807)
t.integer :int8, :limit => 8 # bigint (8 bytes)
t.integer :int11, :limit => 11 # int (4 bytes)
@rderoldan1
rderoldan1 / README.md
Last active February 7, 2021 19:04
Install libffi-devel

The problem

While I was configuring Ruby on Rails in a Red Hat (CentOS) with RVM I found a problem with the library libffi-devel because the package wasn't available via yum install, after search for a couple of days I found this solution.

Add rpmforge as a repository

  1. Create a repo file in /etc/yum.repos.d/rpmforge.repo, you need to be an admin
  2. Copy the following text.
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@rderoldan1
rderoldan1 / filter.js.coffee
Created June 18, 2013 21:56
Search in a table with coffeescript, hide not matched
$ ->
$('#search').keyup ->
searchTable($(this).val())
searchTable = (inputVal) ->
table = $('.table')
table.find('tr').each (index, row) ->
if index != 0
allCells = $(row).find('td')
@rderoldan1
rderoldan1 / application_helper.rb
Last active December 17, 2015 10:18
fetch all countries via web service in rails in order to choose in a select_tag using http://api.worldbank.org
module ApplicationHelper
def select_country
countries = JSON.parse(open('http://api.worldbank.org/v2/es/countries?format=json&&per_page=250').read).last
countries.map {|key, val|[key["name"], key["iso2Code"]] unless key["name"].blank? }.compact!
end
end
@rderoldan1
rderoldan1 / wicked_pdf.rb
Created May 14, 2013 17:15
wicked pdf configuration
module WickedPdfHelper
def wicked_pdf_stylesheet_link_tag(*sources)
sources.collect { |source|
"<style type='text/css'>#{Rails.application.assets.find_asset("#{source}.css")}</style>"
}.join("\n").gsub(/url\(['"](.+)['"]\)(.+)/,%[url("#{wicked_pdf_image_location("\\1")}")\\2]).html_safe
end
def wicked_pdf_image_tag(img, options={})
image_tag wicked_pdf_image_location(img), options
end