Skip to content

Instantly share code, notes, and snippets.

@rfos
rfos / limpiar-qtranslate.sql
Created July 2, 2023 10:39 — forked from joseconti/limpiar-qtranslate.sql
Limpiar qTranslateX
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `wp_4_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `wp_3_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
@rfos
rfos / qtranslate_cleanup.sql
Created July 2, 2023 10:39 — forked from nr1q/qtranslate_cleanup.sql
clean database after qTranslate uninstall
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
## fill `tmp_exceprt` column
UPDATE wp_posts SET tmp_excerpt =
import React, { useState } from 'react'
import './styles.css'
const App = () => {
const [formValues, setFormValues] = useState([{ name: "", email : ""}])
let handleChange = (i, e) => {
let newFormValues = [...formValues];
newFormValues[i][e.target.name] = e.target.value;
@rfos
rfos / wl-api.php
Created April 11, 2021 09:56 — forked from ivandoric/wl-api.php
WordPress Rest API Custom Endpoints Video Tutorials Notes - Check out the videos: https://www.youtube.com/watch?v=C2twS9ArdCI and https://www.youtube.com/watch?v=76sJL9fd12Y
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
@rfos
rfos / 1. Building PHP-MAMP on Apple Silicon M1.md
Created April 3, 2021 08:45 — forked from lennardv2/1. Building PHP-MAMP on Apple Silicon M1.md
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
Rosetta2 191.654 sec 1.96 MOp/s
Intel i7-4790K (imac 2014) 156.791 sec 2.39 MOp/s
Intel i5-8500B (mini 2018) 141.381 sec 2.65 MOp/s
ARM m1 43.745 sec 8.58 MOp/s
@rfos
rfos / node_nginx_ssl.md
Created February 7, 2021 16:35 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@rfos
rfos / validacao.php
Created February 17, 2015 01:47
Validação Link
//UserController.php
public function validarSenha($id, $token) {
$this->autoRender = false;
if (empty($id) || empty($token))
throw new NotFoundException;
if ($user = $this->User->passReset($id, $token)) {
@rfos
rfos / gist:63bef38df8b9b0168b66
Created January 28, 2015 19:54
Chamando o AuthComponent
class AppController extends Controller {
public $components = array(
'Acl',
'Session',
'Email',
'DebugKit.Toolbar',
'Auth' => array(
'loginRedirect' => array(
<?php
App::uses('AppModel', 'Model');
App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth');
App::uses('AuthComponent', 'Controller/Component');
App::uses('CakeEmail', 'Network/Email');
/**
* User Model
*
*/
class User extends AppModel {
public function validarEmail($id,$codigo)
{
$count = $this->User->find('count', array('conditions' => array('User.id =' => $id,'User.codigo =' => $codigo)));
if($count)
{
$this->User->id = $id;
$this->User->set('status','1');
$this->User->set('ativacao','1');
$this->User->set('codigo','0');