- rails 3.2+
- rspec-rails
- factory-girl
- You have a Rails application with several engines.
const maxLength = (firstString) => (secondString) => { | |
return firstString.length > secondString.length ? | |
firstString.length : | |
secondString.length | |
} | |
module.exports = { maxLength } |
require 'yaml' | |
# For some weird reason I ended up creating a script to create specs | |
# for testing the I18n Locale file. It happens that I never used it anyway | |
# but it might be of use to someone so I'll leave it here. | |
# | |
# This assumes you use I18n, and also uses the YAML gem. The example is | |
# default configured for the Rails path to the locale file, but off course | |
# you can change it. | |
# | |
# Note: This is just a generator in case you already started your project |
This quick tips would help you write better user stories, and group them in themes. As a quick reference here are a few examples
Description: What does this project do and who does it serve?
state_machine :initial => :unassigned do | |
after_transition :on => [:accept, :assign], :do => :save | |
# Reject | |
event :reject do | |
transition :assigned => :unassigned | |
end | |
after_transition :on => :reject do |
<?php | |
// Importamos el archivo que tiene las funciones para conectar a la base de datos | |
require_once("c:/wamp/www/ejercicio/modelos/bd_con.php"); | |
class mProducto{ | |
public static $categorias = array("Bazar", "Carniceria", "Panaderia", "Regaleria"); | |
public static $tags = array("Oferta 10%", "Oferta 20%", "Oferta 30%"); | |
public static $nombreTabla = "Productos"; | |
private $id; | |
private $codigo_de_barras; | |
private $titulo; |
<?php | |
function conectar_con_bd(){ | |
$user = "root"; | |
$pass = ""; | |
$server = "localhost"; | |
$bd = "bdLibros"; | |
$link = mysql_connect($server,$user,$pass); | |
mysql_select_db($bd,$link); | |
return $link; | |
} |
body, h1, h2, h3, div, p, u, strong, img, ul, li, a { margin:0; padding:0;} | |
#contenedor { width:900px; margin:auto;} | |
div#cabecera { margin-bottom:20px;} | |
div div h3 { font-size:28px; color:purple; text-decoration:underline;} | |
div div #logo h3 { font-size:38px; color:red;} | |
#logo h3 { color:blue;} | |
#contenido h1 { padding:2px;} | |
#contenido h1 { font-size:26px; color:red; padding:5px;} | |
h1 { border:1px solid black;} | |
.noticia img { width:200px; height:200px; float:left;} |
<?php | |
function devolver_ordinal($elem, $ordenados){ | |
for($x=0;$x<count($ordenados);$x++){ | |
$ordenado = $ordenados[$x]; | |
if($elem == $ordenado){ | |
return $x; | |
} | |
} | |
return 999999; | |
} |