Skip to content

Instantly share code, notes, and snippets.

View amuino's full-sized avatar

Abel Muiño amuino

View GitHub Profile
@amuino
amuino / bingo-de-letras.rb
Last active April 11, 2020 14:41
Bingo de letras
# Juego para niñas y niños de ~5 años
# Cada jugador tiene un cartón y marca las letras que van saliendo
# El primer jugador en marcar todos los números, gana!
#
# PD, con más edad, también es divertido tocar el código para que haga otras cosas…
#
# COMO USAR:
# Abrir `Terminal.app` (En Aplicaciones > Utilidades)
# Teclear el comando `irb`
# Pegar el código para jugar
@amuino
amuino / robot_simulator_1.exs
Last active November 21, 2018 23:47
Exercism Robot Simulator
defmodule RobotSimulator do
@directions [:north, :east, :south, :west]
@doc """
Create a Robot Simulator given an initial direction and position.
Valid directions are: `:north`, `:east`, `:south`, `:west`
"""
@spec create(direction :: atom, position :: {integer, integer}) :: any
def create(direction \\ :north, position \\ {0, 0})
@amuino
amuino / webinspector.applescript
Last active April 29, 2017 06:47
AppleScript to hook up Safari web inspector to a connected iOS device or Emulator
# Customize and Export as Application
set device_name to "My iPhone"
tell application "Safari"
activate
tell application "System Events"
click menu item "index.html" of menu device_name of menu item device_name of menu "Develop" of menu bar item "Develop" of menu bar 1 of application process "Safari"
end tell
end tell
@amuino
amuino / ping al router
Created March 16, 2013 15:29
Un ejemplo de mi vida con el router Scientific Atlanta de @ono_ono via WIFI
Request timeout for icmp_seq 219
Request timeout for icmp_seq 220
Request timeout for icmp_seq 221
Request timeout for icmp_seq 222
Request timeout for icmp_seq 223
Request timeout for icmp_seq 224
Request timeout for icmp_seq 225
Request timeout for icmp_seq 226
Request timeout for icmp_seq 227
Request timeout for icmp_seq 228
@amuino
amuino / gist:3766049
Created September 22, 2012 12:31
Fast RSpec without Spork - avoid loading rails again and again
rails c test
ActiveRecord::Base.logger.level = Logger::WARN
require 'rspec'
reload! ; RSpec::Core::Runner.run ["spec"]
reload! ; RSpec::Core::Runner.run ["spec"]
reload! ; RSpec::Core::Runner.run ["spec"]
reload! ; RSpec::Core::Runner.run ["spec"]
reload! ; RSpec::Core::Runner.run ["spec"]
reload! ; RSpec::Core::Runner.run ["spec"]
@amuino
amuino / DefensiveProgramming.java
Created July 19, 2011 17:36
The wrong mindset
int numberOfThingsThatAreSorted = getCustomComparatorNumberOfKnownThingsForSorting();
int numberOfActualThings = getAllThings().size();
if (numberOfThingsThatAreSorted < numberOfActualThings)
throw new IllegalStateException(
"An implementation of ThisClass (whose abstract subclasses are ThatOtherClass and YetAnotherClass) "
+ "must ensure that all the Things it specifies are also passed in for custom sorting. Instead found only "
+ numberOfThingsThatAreSorted
+ " Things to be sorted, as implemented by getCustomComparatorNumberOfKnownThingsForSorting, but "
+ numberOfActualThings + " actual Things.");
@amuino
amuino / example.html
Created June 1, 2011 20:32
Copy of "flash" effect in Ducksboard.com
<!DOCTYPE html>
<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">
<style>
body {
<!DOCTYPE html>
<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">
<style type="text/css" media="screen">
body {
@amuino
amuino / Link.txt
Created April 4, 2011 15:17
Resultado de rake stats para el proyecto pymeprivee del All Together Now
@amuino
amuino / weird_date_calculation.rb
Created March 30, 2011 22:16
Rails does really funny things in the late hours
# It is 00:15
ruby-1.9.2-p180 :025 > Time.now
=> 2011-03-31 00:15:10 +0200
# Today is 31st of March
ruby-1.9.2-p180 :023 > Date.today
=> Thu, 31 Mar 2011
# Yesterday was 29 of March ????? WTF!!!
ruby-1.9.2-p180 :024 > Date.yesterday