Skip to content

Instantly share code, notes, and snippets.

View filipecrocks's full-sized avatar

Filipe Pawlik filipecrocks

View GitHub Profile
@filipecrocks
filipecrocks / validar_rut.php
Created August 24, 2018 13:22 — forked from rbarrigav/validar_rut.php
Validar Rut en php
<?php
/**
* Comprueba si el rut ingresado es valido
*
* @param $rut string
* @return true o false
*/
function valida_rut($rut)
@filipecrocks
filipecrocks / 0. intro.md
Created August 5, 2017 13:34 — forked from jquense/0. intro.md
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&amp;%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

@filipecrocks
filipecrocks / function.php
Created June 30, 2017 21:17 — forked from swapnilshrikhande/function.php
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,