Category Archives: OpenSource

Meet Easton LaChappelle, The 19-Year-Old Luminary Building A Cheaper, Better Prosthetic Limb

You probably haven’t heard much about 19-year-old Easton LaChappelle, though he’s already done enough to land a job at NASA. Simply put, LaChappelle is changing the world for the better.

There’s been a fundamental shift in how we see technology. Science and engineering are no longer just industries. Technology is something we’re passionate about, whether we’re arguing over the iPhone or eagerly anticipating the next technology that will change everything. Just like every song has a story, the technology we most care about has a deeply personal journey behind it, from Steve Jobs’ decades-long obsession with changing how we use computers to Sergey Brin and Larry Page turning a fascination with the mathematics that underlie how we use the Internet into Google. Just like we care as much about the singer as we do the song, we care about the engineer behind the world-changing idea.

In Luminaries, the first original series from Uproxx, we find some of the most fascinating people in science and technology, and tell you not just what they’re making and how it’s revolutionary, but the creative process and the inspiration behind it. For example, Easton’s prosthetic arm came about because he met a little girl using a limb that cost $80,000. That struck him as far too much.

So Easton taught himself robotics and combined open source designs with 3D printing to create a completely functional prosthetic arm. Even as Easton refines his designs, he’s using new and more powerful tools such as the HP Sprout to post his designs online for anyone to refine, repurpose, and use. He’s not just creating one thing, he’s giving everyone the ability to be their own engineer, to take what was once an involved, arcane process and make it one anyone can do. As tools such as the HP Sprout continue to proliferate, making 3D modeling and object scanning as simple as placing the object under a camera, we’ll continue to find new luminaries, and seeing how they redefine the world.

Source: http://uproxx.com/technology/2015/01/easton-lachappelle-luminary

Crunchbase API PHP Library

Por alguna razón se me ocurrió hacer una librería PHP para el API de Crunchbase. La misma se puede descargar de GitHub.

Uso:

require_once('crunchbase.php');

$crunchbase 	= new CrunchBase($user_key = 'XXX', $format = 'array');
$organizations 	= $crunchbase->organizations(array('query' => 'wharton school', 'organization_types'=> array('company', 'investor')));

foreach ($organizations['data']['items'] as $organization)
{
	echo "<p><a href=\"".$organizations['metadata']['www_path_prefix'].$organization['path']."\">".$organization['name']."</a></p>";
}

Edit (07/12/2014): La gente de CrunchBase ya ha agregado la librería dentro de su documentación :)

Screen Shot 2014-12-09 at 1.04.22 AM

Callback para validar CUIT con CodeIgniter PHP

Comparto cómo validar un número de CUIT/CUIL usando un callback de form_validation en un controlador de CodeIgniter:

// Cargo la libreria de validacion de formularios
$this->load->library('form_validation'); 

// Defino las reglas de validacion del formulario
$this->form_validation->set_rules('cuit', 'CUIT', 'xss_clean|required|numeric|callback_valid_cuit');

// ...

if ($this->form_validation->run() != FALSE)
{
    // Todo OK.
}
else
{
    // Error /:
}

Método de callback:

/*
 * Form Validation Callback: Valida un Nro. de CUIT
 */
public function valid_cuit($cuit)
{
    $cuit_array = str_split(str_replace(array(' ', '-'), array(), $cuit));

    if ((count($cuit_array) < 11) OR (count($cuit_array) > 11))
    {
        // Usando lang
        // $this->form_validation->set_message('valid_cuit', $this->lang->line('form_cuit_error'));
        $this->form_validation->set_message('valid_cuit', 'Error al validar el CUIT');

        return FALSE;
    }

    $result  = $cuit_array[0] * 5;
    $result += $cuit_array[1] * 4;
    $result += $cuit_array[2] * 3;
    $result += $cuit_array[3] * 2;
    $result += $cuit_array[4] * 7;
    $result += $cuit_array[5] * 6;
    $result += $cuit_array[6] * 5;
    $result += $cuit_array[7] * 4;
    $result += $cuit_array[8] * 3;
    $result += $cuit_array[9] * 2;

    $div    = intval($result / 11);
    $resto  = $result - ($div * 11);

    if ($resto == 0)
    {
        return ($resto == $cuit_array[10]) ? TRUE : FALSE;
    }
    elseif ($resto == 1)
    {
        if (($cuit_array[10] == 9) AND ($cuit_array[0] == 2) AND ($cuit_array[1] == 3))
        {
            return TRUE;
        }
        elseif (($cuit_array[10] == 4) AND ($cuit_array[0] == 2) AND ($cuit_array[1] == 3))
        {
            return TRUE;
        }
    }
    elseif ($cuit_array[10] == (11 - $resto))
    {
        return TRUE;
    }
    else
    {
        // Usando lang
        // $this->form_validation->set_message('valid_cuit', $this->lang->line('form_cuit_error'));
        $this->form_validation->set_message('valid_cuit', 'Error al validar el CUIT');

        return FALSE;
    }
}