Skip to content

Instantly share code, notes, and snippets.

View angelmartz's full-sized avatar

Juan Angel Martínez Lopez angelmartz

  • CDMX, Mexico
  • 13:05 (UTC -06:00)
View GitHub Profile
@angelmartz
angelmartz / AppName.php
Created March 21, 2020 23:10 — forked from isluewell/AppName.php
[6.0] Command app:name
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
use Symfony\Component\Finder\Finder;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputArgument;
@angelmartz
angelmartz / aes_enc_dec.php
Created March 9, 2020 17:50 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@angelmartz
angelmartz / CreatesWithLock.php
Created March 6, 2020 00:39 — forked from troatie/CreatesWithLock.php
Guard against race conditions in Laravel's firstOrCreate and updateOrCreate
trait CreatesWithLock
{
public static function updateOrCreate(array $attributes, array $values = [])
{
return static::advisoryLock(function () use ($attributes, $values) {
// emulate the code found in Illuminate\Database\Eloquent\Builder
return (new static)->newQuery()->updateOrCreate($attributes, $values);
});
}
@angelmartz
angelmartz / Laravel-Container.md
Created January 29, 2020 22:24
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

docker-compose exec mysql bash
mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
FIX
Hello,
i have found the solution.
You need to download and install manually new version of m4 autom4te and autoconf.
You can do so by doing:
cd /usr/local/src
wget https://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
@angelmartz
angelmartz / index.html
Created March 21, 2017 18:32
Hecho en México
<style>
.crop {
float: left;
margin: .5em 10px .5em 0;
overflow: hidden;
/* border: 1px solid #ccc; */
}
.crop img {
margin: -3px -3px -3px -3px;
CentOs 7
Para estas instrucciones se requiere CentOs 7.
Para instalar Nginx , PHP y MySQL
Necesitamos wget y screen
# yum install wget screen
Abrimos una nueva ventana de screen
# screen -S lnmp
@angelmartz
angelmartz / index.html
Created November 10, 2016 22:21 — forked from anonymous/index.html
Capture FB Reactions count and show them on webpage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My FB Reactions Page</title>
<style>
html {
box-sizing: border-box;
width: 100%;
@angelmartz
angelmartz / kill.sh
Created October 25, 2016 19:50
PID PHP Kill
SSH into the server
Type in ps x
See the list of processes currently on your server
Get the PID(process id) from that list and type kill xxxxx
That should do it.