Skip to content

Instantly share code, notes, and snippets.

View rderoldan1's full-sized avatar
🇨🇴

Ruben Espinosa rderoldan1

🇨🇴
  • Medellin, Colombia
View GitHub Profile
@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.
@rderoldan1
rderoldan1 / formater.java
Created October 10, 2012 16:02
Method to format long numbers in GB, MB and KB
private String format_long(long number){
String formatted;
if (number > 1000000000) {
String re = "^(.*)\\d{9}$";
Matcher m = Pattern.compile(re).matcher(Long.toString (number));
if (m.find()) {
formatted = m.group(1) + " Gb";
} else {
formatted = "0";
}
@rderoldan1
rderoldan1 / formula.java
Last active January 2, 2016 17:19
Cambio en formulas de Reportes Vcenter
/*
* Formula Memoria
*/
row.createCell(8).setCellFormula("(100-I1-G"+(inicial+1)+")%*C"+(inicial +1));
/*
* Formula Procesador
*/
row.createCell(7).setCellFormula("(100-I1-F"+(inicial+1)+")%*B"+(inicial +1));
@rderoldan1
rderoldan1 / README.md
Created December 13, 2013 16:03
Ignore file changes in git

Fortunately GIT has a very easy solution for this, just run the following command on the file or path you want to ignore the changes of:

git update-index --assume-unchanged <file>

If you wanna start tracking changes again run the following command:

git update-index --no-assume-unchanged <file>

source: http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files/

@rderoldan1
rderoldan1 / gist:7363635
Created November 7, 2013 23:24
ejemplo
clase Jugador
edad = 0
goles = 0
nacimiento = 0000-00-00
posicion = ""
valor = 0
inicializador(edad, goles, nacimiento, posicion)
edad = edad
@rderoldan1
rderoldan1 / 0_reuse_code.js
Created November 7, 2013 15:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rderoldan1
rderoldan1 / _partial.html.erb
Created September 24, 2013 13:29
PDF Rendering using partials
<h5>Mi partial content</h5>
<%= @object.some_attribute %>
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)