Skip to content

Instantly share code, notes, and snippets.

View amuino's full-sized avatar

Abel Muiño amuino

View GitHub Profile
@amuino
amuino / trucos.css
Created March 23, 2011 09:21
Trucos de CSS vistos en webs reales para efectos "vistosos"
/* Texto elevado */
.elevado {
color: white;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.68);
}
/* Texto hundido (grabado) */
.hundido {
color: #243748;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.33);
@amuino
amuino / Quicksort interactivo.html
Created February 14, 2011 18:01
Partiendo del algoritmo de quicksort en javascript, modificarlo para que sea el usuario el que decida el resultado de la comparación (por ejemplo, para ordenar un ranking con "pocos" clicks enfrentando elementos dos a dos). http://en.literateprograms.org
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Abel Muiño Vizcaino">
<!-- Date: 2011-02-14 -->
require 'rspec'
class Fixnum
ROMANS = { M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X: 10, IX: 9, V: 5, IV: 4, I: 1 }
def to_roman
remaining_number = self
ROMANS.inject ("") do | roman_str, current_number |
times,remaining_number = remaining_number.divmod current_number[1]
roman_str + current_number[0].to_s * times
@amuino
amuino / Receta.sh
Created January 31, 2011 10:57
Receta para "sincronizar" con 12meses12katas
# Repo de 12meses12katas añadido como "upstream"
git remote add upstream https://github.com/12meses12katas/Enero-String-Calculator.git
# Obtener última versión (sin modificar working tree)
git fetch upstream
# Mezclar los commits de 12meses12katas en nuestro working tree
git merge upstream/master
## OPCIONALMENTE, se puede hacer git merge --squash upstream/master para "comprimir"
@amuino
amuino / Plagelao's kata
Created January 30, 2011 19:22
Example of the weird magic that makes plagelao's kata work without working :-)
# Open irb on the kata directory
ruby-1.9.2-p0 > require "./string_calculator_spec"
=> true
ruby-1.9.2-p0 > s = Separator.new("//[**][+++]\n")
=> /,|
|["**|+++"]/
ruby-1.9.2-p0 > #Ojo al último patrón! Eso matchea cualquier caracter dentro de []
ruby-1.9.2-p0 > "1++2***3".split(s)
@amuino
amuino / gist:745724
Created December 17, 2010 21:21
¿Defraudar IVA?
Compro 1 queso por 10€+IVA(4%) y 100 botellas de vino por 1000€+IVA(18%).
Total IVA soportado: 0.40€ + 180€ = 180.04€
Vendo 1 queso por 1010€+IVA(4%) y regalo 100 botellas de vino.
Total IVA repercutido: 40.40€
Balance: Hacienda me tiene que devolver 140.04€. Gano dinero incluso sin incluir margen de beneficio en la venta…
@amuino
amuino / README.txt
Created November 30, 2010 17:33
This code used to work, but breaks in 3.0.3
Something in rails 3.0.3 broke mysql2.
It seems to also break some other gems:
https://github.com/ProtectedMethod/restful_acl/issues/issue/9
@amuino
amuino / README.TXT
Created October 19, 2010 08:56
Snowflake test file (with missing commas)
This file comes form http://groups.google.com/group/twitter-api-announce/browse_thread/thread/6a16efa375532182?hl=en
The original is missing a couple of commas near the end.
require File.dirname(__FILE__) + '/../test_helper'
require 'signup_controller'
# Re-raise errors caught by the controller.
class SignupController; def rescue_action(e) raise e end; end
#
# Adivinen pq falla el assert_not_nil current_user, cuando no debería :-)
#
class SignupControllerTest < ActionController::TestCase
pantalla:~/dev/nilistics/Plant/pom-converter
amuino$ ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=5 ttl=64 time=4105.769 ms
64 bytes from 192.168.1.2: icmp_seq=6 ttl=64 time=3155.822 ms
64 bytes from 192.168.1.2: icmp_seq=13 ttl=64 time=104.651 ms
64 bytes from 192.168.1.2: icmp_seq=14 ttl=64 time=480.029 ms
64 bytes from 192.168.1.2: icmp_seq=15 ttl=64 time=963.999 ms
64 bytes from 192.168.1.2: icmp_seq=16 ttl=64 time=11.477 ms
64 bytes from 192.168.1.2: icmp_seq=19 ttl=64 time=5145.009 ms