Skip to content

Instantly share code, notes, and snippets.

View emmanuelbarturen's full-sized avatar
🌱
Give me an challenge

Emmanuel Barturen emmanuelbarturen

🌱
Give me an challenge
View GitHub Profile
@emmanuelbarturen
emmanuelbarturen / FirebaseService.php
Created February 16, 2018 00:29
Firebase rest with guzzle
<?php namespace App\Services;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
/**
* Class FirebaseService
* @package App\Services
*/
class FirebaseService
@emmanuelbarturen
emmanuelbarturen / reply_database_in_local.sh
Created January 29, 2018 14:46
pulling database in local via ssh
#!/bin/bash
# SSH
ID_RSA=~/.ssh/id_rsa
USER=root
DOMAIN=my-domain.com
# Remote mysql
REMOTE_DB_USER=root
REMOTE_DB_PASS=database-password
@emmanuelbarturen
emmanuelbarturen / steps.txt
Created January 3, 2018 02:38
configure sendmail in a ubuntu droplet
1) If sendmail isn't installed, install it: apt-get install sendmail
2) Configure hosts file correctly: nano /etc/hosts
Looked like:
127.0.1.1 myhostname myhostname
127.0.0.1 localhost
3) $ sudo sendmailconfig
4) test
$echo "Subject: sendmail test" | sendmail -v my@email.com
@emmanuelbarturen
emmanuelbarturen / instructions.txt
Created December 24, 2017 13:38
wordpress permission recomended
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
@emmanuelbarturen
emmanuelbarturen / Component.vue
Created December 19, 2017 22:32
event handler keypress vuejs
created: function () {
window.addEventListener('keyup', (event)=> {
if (event.keyCode === 27) {
this.showEditor = false;
}
});
},
@emmanuelbarturen
emmanuelbarturen / FormRequest.php
Last active February 5, 2018 17:22
available methods in form request
<?php namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class UpdateBoosterFormRequest extends FormRequest
{
protected $errorBag = 'edit';
/**
* Determine if the user is authorized to make this request.
@emmanuelbarturen
emmanuelbarturen / ClassAttribute.php
Last active November 22, 2017 16:30
Create Accesors like laravel in object
class TheAttribute
{
public function __get($name)
{
$name = array_map('ucfirst', explode('_', $name));
$name = implode($name);
# use echo instead return if is not a framework
return $this->{'get' . $name . 'Attribute'}();
}
@emmanuelbarturen
emmanuelbarturen / check mail with tinker
Last active July 25, 2020 18:59
check if mail service working correctly from artisan
# ssh into the server
# go to the laravel project
$ php artisan tinker
# Example 1 , from view
$ Mail::send('errors.401',[],function($message){$message->to('emmanuelbarturen@gmail.com')->subject('this works!');});
# Example 2, plain text
Mail::raw('Hi Mail Service',function($message){$message->to('emmanuelbarturen@gmail.com')->subject('this works!');});
@emmanuelbarturen
emmanuelbarturen / testing mail in droplet with laravel
Created November 3, 2017 23:12
send email from artisan with tinker of laravel
# SSH into droplet
# go to project
$ php artisan tinker
$ Mail::send('errors.401', [], function ($message) { $message->to('emmanuelbarturen@gmail.com')->subject('this works!'); });
# check your mailbox
@emmanuelbarturen
emmanuelbarturen / descripcion.txt
Created October 31, 2017 14:47
Social Auth de Google+
ir a https://console.developers.google.com/project/_/apiui/apis/library
crear credenciales > ID de Cliente OAUTH
Origines de JS autorizados = http://domain.com
URL de redireccionamiento autorizados = http://domain.com/g-callback
Copiar credenciales en .env de laravel