Skip to content

Instantly share code, notes, and snippets.

View iamricard's full-sized avatar
🐕‍🦺

Ricard Solé iamricard

🐕‍🦺
View GitHub Profile
def factorial_mutante (base, jump = 1):
errors = {
'101': 'El valor debe ser positivo o cero.',
'102': 'El valor no puede ser superior a 10.',
'103': 'El valor debe ser entero.',
'201': 'El salto debe ser positivo.',
'202': 'El salto no puede ser superior a 5.',
'555': 'Error desconocido.',
}
# Lo ideal seria crear una clase per error, suposo
// Crea una clase Finanzas que convierta dólares a euros y viceversa.
// Codifica los métodos de instancia dolaresToEuros y eurosToDolares.
// Prueba que la clase Finanzas funciona correctamente haciendo conversiones
// entre euros y dólares. Como requisitos la clase Finanzas tiene que tener:
// * Un constructor sin parámetros Finanzas(), que establecerá el cambio
// Dólar - Euro en 1.36
// * Un constructor Finanzas (double cambio), que permitirá configurar el
// cambio dólar - euro
import java.util.*;
import java.io.*;
class Ejercicio4 {
public static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
// public static String[][] peliculas = new String[5][2];
public static final byte director = 2;
public static final byte genero = 1;
public static final byte titulo = 0;
def update_stock(movements, stock, reference, min_stock):
if not stock:
stock = 0
if not min_stock:
min_stock = 0
output_string = ''
@iamricard
iamricard / main.lua
Created January 17, 2014 12:04
facebook
MOAISim.openWindow ( "Test Menu", 960, 640 )
MOAIGfxDevice.getFrameBuffer():setClearColor ( 1, 1, 1, 1 )
-- VIEWPORT
viewport = MOAIViewport.new ()
viewport:setSize ( 960, 640 )
viewport:setScale ( 960, 640 )
-- LAYER
partition = MOAIPartition.new ()
@iamricard
iamricard / Game.cpp
Created March 30, 2014 21:04
sdl2, box2d, cmake
// Copyright 2014-present [Ricard Sole <@rcsole, [email protected]>]
#include <cstdio>
#include "./Game.h"
bool Game::init(const char* title, int xpos, int ypos, int width,
int height, int flags) {
if (SDL_Init(SDL_INIT_EVERYTHING) == 0) {
printf("SDL_Init success\n");
@iamricard
iamricard / Dosificador.php
Created August 31, 2014 13:11
PHP example
<?php
class Dosificador {
private $name;
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<div class="container" style="margin-top: 50px;">
<button class="btn btn-primary hello-button">Do Something</button>
</div>
@iamricard
iamricard / README.md
Last active May 31, 2016 07:52
DOM Manipulation exercise

Make the card

When the user clicks “Submit”, their input should display on the card

  • Get the value of each input field
  • Add it as HTML to the correct element in the business card template

Change the color

When the user clicks “Submit”, their input should display on the card

  • Get the value of each input field
  • Add it as HTML to the correct element in the business card template
<html>
<style>
pre {
height: 25px;
overflow: hidden;
}
.expanded {
height: auto;
}