Skip to content

Instantly share code, notes, and snippets.

View tubalmartin's full-sized avatar

Túbal Martín tubalmartin

  • Expedia Group
  • Madrid, SPAIN
  • 19:06 (UTC +02:00)
View GitHub Profile
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import VisibilitySensor from 'react-visibility-sensor';
import {logExperiment} from '@homeaway/abacus-client-utils';
const style = {
minHeight: '1px',
marginTop: '-1px',
display: 'block'
@tubalmartin
tubalmartin / render.js
Created October 29, 2018 16:20
renderToNodeStream render function snippet
const ReactDOMServer = require('react-dom/server');
const render = (reactComponent) => {
return new Promise((resolve, reject) => {
const body = [];
const bodyStream = ReactDOMServer.renderToNodeStream(reactComponent);
bodyStream.on('data', (chunk) => {
body.push(chunk.toString());
});
bodyStream.on('error', (err) => {
@tubalmartin
tubalmartin / gist:789785071b66704f8efe87445d7122c9
Created April 4, 2017 14:50 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
//
// the regular expression composed & commented
// could be easily tweaked for RFC compliance,
// it was expressly modified to fit & satisfy
// these test for an URL shortener:
@tubalmartin
tubalmartin / gist:5137275
Created March 11, 2013 20:07
set_header
<?php
/**
* Add a Header Item
*
* @access public
* @param string
* @param string
* @return void
*/
@tubalmartin
tubalmartin / rsa_key_generator.php
Created February 14, 2013 02:36
PHPSecLib RSA KEY GENERATOR
<?php
header("Content-type: text/html; charset=UTF-8");
$nl = '<br>';
// http://bestmike007.com/2011/08/secure-data-transmission-between-pure-php-and-javascript-using-rsa/
// Include Library
require_once(dirname(__FILE__) . '/../application/libraries/phpseclib-0.3.1/Crypt/RSA.php');
@tubalmartin
tubalmartin / gist:4345844
Created December 20, 2012 15:13
Sistema reglas validación multi-form
<?php
class MY_Model extends CI_Model {
// Form validation rules
protected $rules;
// Sets form validation rules
protected function set_rules($field_name)
{
@tubalmartin
tubalmartin / gist:4345529
Created December 20, 2012 14:17
Validación NIF de personas jurídicas y entidades en general (ESPAÑA)
<?php
/**
* Valida NIF de personas jurídicas y entidades en general
*
* @param string $nif NIF to check
*
* @return bool returns true on success false otherwise
*/
function nifEntity($nif)
<?php if (!defined('BASEPATH')) exit('No direct access allowed.');
class Profiles extends Auth_Controller
{
protected $_view_path = 'profiles/';
public function __construct()
{
parent::__construct();
@tubalmartin
tubalmartin / gist:4270292
Created December 12, 2012 18:28
Facebook FQL result
USERINFO
Array
(
[data] => Array
(
[0] => Array
(
[name] => user
[fql_result_set] => Array