Skip to content

Instantly share code, notes, and snippets.

View TiagoGouvea's full-sized avatar

Tiago Gouvêa TiagoGouvea

View GitHub Profile
@TiagoGouvea
TiagoGouvea / create-instance.sh
Last active May 2, 2020 13:47
Sample script to create a Google Compute Engine VM instance
#!/usr/bin/env bash
echo -e "\nCreate remote instance"
echo -e "\n# 1/2 - Loading and setting options..."
## Show commands (if you want to check, uncomment it)
#set -x
## Stop on errors
set -e
@TiagoGouvea
TiagoGouvea / config.sh
Last active May 1, 2020 20:31
Config file to help create a remote instance on Google Cloud Platform
#!/usr/bin/env bash
## Google cloud config
PROJECT="node-docker-gcp"
ZONE="us-central1-a"
## Instance settings
INSTANCE_NAME="my-compute-instance"
### Instance creation settings
@TiagoGouvea
TiagoGouvea / class-database-proxy.php
Created May 21, 2018 11:35
FIX to "strpos(): Empty needle in /class-database-proxy.php on line 44"
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Represents the proxy for communicating with the database
*/
@TiagoGouvea
TiagoGouvea / mail_signature.html
Last active March 11, 2018 15:33
My email signature
<!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 January 19, 2018 13:59
ucWords to JavaScript
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 January 19, 2018 14:00
Return person first name or surName
/**
* 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 '';
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 June 12, 2017 12:34
Responvie detect in window.resize
componentDidMount() {
window.addEventListener("resize", ()=> {
this.updateDimensions();
});
this.updateDimensions();
}
updateDimensions() {
let w = window,
@TiagoGouvea
TiagoGouvea / mass_subscription.php
Last active October 8, 2016 14:36
Wordpress - Subscribe to comments reloaded - Suscribe to all users (bulk, mass)
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;
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;