Run a simple HTTP server with one command line

Recently someone told me this great and simple trick on how to run an HTTP web server with just one command line. This is useful for a million things, but I use it for prototyping and avoid same-origin policy in Chrome. Sure, I know there’s a way to disable it, but you may not want to do that.

XMLHttpRequest cannot load file:///C:/Projects/Test/app/views/shell.html. Cross origin requests are only supported for HTTP.

This is all it takes:

$ cd /projects/TestProject
$ python -m SimpleHTTPServer 1234

Then you can access your files at localhost:1234.

I think this provides a much real environment while you build your HTML/JS. That way, you can have a more accurate preview on how your UI is going to feel when served through the Internet by a real server.

Note: This can also be achieved using PHP and probably a gazillion other programming languages.

Set friendly names for validation attributes in Laravel 4

I just lost half an hour on this, so I figured I’d help you save some precious time.

Every search on Google returned info on how to specify custom messages, which is nicely documented, but there’s currently nothing about friendly names on attributes on the docs.

After searching on Google, roaming through Laravel’s code and trying almost everything, I got to this comment on GitHub.

You may call setAttributeNames on a Validator instance now.

So, for example’s sake:

$rules = array(
    ‘username’ => ‘required|min:8|unique:users|integer’,
    ‘firstname’ => ‘required’,
    ‘lastname’ => ‘required’,
    ‘email’ => ‘required|email’,
    ‘password’ => ‘required|confirmed’

$messages = array(
    ‘required’ => ‘El campo :attribute es obligatorio.’,
    ‘email.required’ => ‘El campo de :attribute es requerido y debe ser una dirección válida.’,
    ‘validation.confirmed’ => ‘Las contraseñas no coinciden.’

$friendly_names = array(
    ‘firstname’ => ‘Nombre’,
    ‘lastname’ => ‘Apellido’

$validator = Validator::make(Input::all(), $rules, $messages);

Fest Contrapedal 2013

Ayer lanzamos junto a GRMN y todo el equipo de Contrapedal el sitio web del Fest, edición 2013.

Este será primer trabajo oficial bajo el nombre de MONTAG, proyecto que formamos junto a Germán.

Los invito a visitar el sitio, ver la programación y asistir a los espectáculos, el baratón, paneles e instalaciones:

Fest Contrapedal 2013




One line browser notepad

I found out this amazing tip the other day that turns a browser tab into a full size editable area. As the author said, many of us live on the browser. So having somewhere to jot down ideas/lists while browsing or programming without leaving “home” is great.

I started using this version, but the link below provides various flavours of the same “hack”. So, check it out if this doesn’t cut it for you ;)

data:text/html, <title>Quick Notes</title><body contenteditable style="font-size:2rem;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">

Jus paste this on your browser address bar.