Skip to content

Instantly share code, notes, and snippets.

View iox's full-sized avatar

Ignacio Huerta iox

View GitHub Profile
@iox
iox / fuelux_test.dryml.html
Last active August 29, 2015 14:23
Fuelux Test with Hobo 2.1
<page title="Home">
<body: class="fuelux"/>
<content:>
<header class="content-header hero-unit">
<h1>Test</h1>
<script src="//www.fuelcdn.com/fuelux/3.6.3/js/fuelux.min.js"></script>
@iox
iox / spreadsheet_currency_test.rb
Created December 11, 2014 11:17
Generate a simple XLS file to show Currency Excel bug
require 'spreadsheet'
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
sheet1.row(0).concat %w{Product Price}
sheet1.row(1).concat ['PC', 1000.55]
sheet1.row(2).concat ['Phone', 200.25]
sheet1.row(3).concat ['Radio', 20.45]
book.write 'spreadsheet_currency_test.xls'
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'lxc'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
@iox
iox / dni_validator.rb
Created June 23, 2013 18:49
Validando DNIs en Rails 3
validates_format_of :dni, :with => /\A[0-9]{8}[A-Za-z]\Z/, :on => :update, :message => "El DNI tiene que tener un formato como el siguiente: 12345678A"
validate :dni_letter_must_match_number
def dni_letter_must_match_number
if "TRWAGMYFPDXBNJZSQVHLCKE"[dni[0..7].to_i % 23].chr != dni[8]
errors.add(:dni, "La letra no coincide con el número")
end
end
@iox
iox / ejemplo.html
Last active December 14, 2015 10:10
Integrar signame en tu web
<a target="_blank" href="http://signame.zentzumenguztiekin.org">
<img src="http://signame.zentzumenguztiekin.org/semaforo">
</a>
@iox
iox / commands.sh
Created January 10, 2013 19:39
n900 as remote webcam
# Send images from the N900:
gst-launch v4l2src device=/dev/video0 ! videoscale! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! jpegenc ! multipartmux ! tcpserversink host=192.168.5.3 po
rt=5000
# Receive images in Ubuntu and pipe them into /dev/video1:
sudo gst-launch tcpclientsrc host=192.168.5.4 port=5000 ! multipartdemux ! jpegdec ! v4l2sink device=/dev/video1
@iox
iox / growl.rb
Created January 10, 2013 19:33
autotest-growl hack to show rspec error line numbers in Ubuntu notifications
require 'rubygems'
require 'autotest'
require 'rbconfig'
require File.join(File.dirname(__FILE__), 'result')
##
# Autotest::Growl
#
# == FEATUERS:
# * Display autotest results as local or remote Growl notifications.