Skip to content

Instantly share code, notes, and snippets.

Tiago Gouvêa TiagoGouvea

Block or report user

Report or block TiagoGouvea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@TiagoGouvea
TiagoGouvea / class-database-proxy.php
Created May 21, 2018
FIX to "strpos(): Empty needle in /class-database-proxy.php on line 44"
View class-database-proxy.php
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Represents the proxy for communicating with the database
*/
View mail_signature.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Assinatura</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0"
@TiagoGouvea
TiagoGouvea / ucWords.js
Created Jan 19, 2018
ucWords to JavaScript
View ucWords.js
fucntion ucWords (str) {
str = str.trim();
str = str.toLowerCase().replace(/^[\u00C0-\u1FFF\u2C00-\uD7FF\w]|\s[\u00C0-\u1FFF\u2C00-\uD7FF\w]/g, function (letter) {
return letter.toUpperCase();
});
return str;
}
@TiagoGouvea
TiagoGouvea / surName.js
Last active Jan 19, 2018
Return person first name or surName
View surName.js
/**
* Return the name and surname
* "Tiago Gouvêa de Oliveira" will return "Tiago Gouvea"
* @author TiagoGouvea
* @param name
* @returns String
*/
function nameSurname (name) {
name = name.trim();
if (!name) return '';
View context.js
import React from 'react';
import * as PropTypes from "prop-types";
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import Snackbar from 'material-ui/Snackbar';
import TextField from 'material-ui/TextField';
export default class Context extends React.Component {
@TiagoGouvea
TiagoGouvea / layout.js
Created Jun 12, 2017
Responvie detect in window.resize
View layout.js
componentDidMount() {
window.addEventListener("resize", ()=> {
this.updateDimensions();
});
this.updateDimensions();
}
updateDimensions() {
let w = window,
@TiagoGouvea
TiagoGouvea / mass_subscription.php
Last active Oct 8, 2016
Wordpress - Subscribe to comments reloaded - Suscribe to all users (bulk, mass)
View mass_subscription.php
global $wp_subscribe_reloaded;
echo "Subscribe old comments<br><br>";
// Get all comments on database
$comments = get_comments(array('type'=>'comment'));
$added=0;
echo "Comments: ".var_dump(count($comments))."<br>";
foreach ($comments as $comment){
$postId=$comment->comment_post_ID;
$email=$comment->comment_author_email;
if (strpos(email,'YOUR_EMAIL')!==false) continue;
View CampaignPerson.php
public function sendCampaignMailSes()
{
if ($this->date_sent != null) {
// Log!!!
$this->showLog("Already sent");
return;
}
if ($this->date_sending != null) {
$this->showLog("Already sending! - since: " . $this->date_sending);
return;
View gist:28a61f970eae3913cbaacc59ddea010f
public function sendEmail($email, $subject, $html, $text)
{
$sesClient = SesClient::factory(array(
'credentials' => array(
'key' => 'YOURKEY',
'secret' => 'YOURSECRET',
),
'region' => 'us-east-1',
'version' => '2010-12-01'
));
@TiagoGouvea
TiagoGouvea / cpf.cs
Created Sep 19, 2016
Validar e formatar CPF
View cpf.cs
public static string SomenteNumeros(string texto = null)
{
if (texto == null) return texto;
Regex re = new Regex("[0-9]");
StringBuilder s = new StringBuilder();
foreach (Match m in re.Matches(texto))
{
s.Append(m.Value);
}
return s.ToString();
You can’t perform that action at this time.