Skip to content

Instantly share code, notes, and snippets.

version: '3.2'
services:
mysql:
image: mysql:8.0
container_name: mysql
hostname: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_DATABASE=opencart
- MYSQL_ROOT_PASSWORD=change_to_secure_password
<?php
echo "Hello World";
@rodurma
rodurma / sort_players.js
Created October 29, 2019 02:12
Ordenando um array com sort
const players = [
{ name: 'Rodrigo', kills: 12 },
{ name: 'Vitor', kills: 9 },
{ name: 'Camila', kills: 17 },
{ name: 'Amanda', kills: 6 }
];
const orderAsc = (a, b) => a.kills - b.kills;
const orderDesc = (a, b) => b.kills - a.kills;
@rodurma
rodurma / first_and_last_elem.js
Created October 29, 2019 01:48
Várias maneiras de pegar o primeiro e último elemento de um array com JavaScript
// considerando o array abaixo
const arr = [4, 7, 10, 82, 35];
// Opção 1: Pelo tamanho do array
let first = arr[0];
let last = arr[arr.length-1];
// Opção 2: Com shift(), pop() e Spread operator
let first = [...arr].shift();
let last = [...arr].pop();
<?php
$json = json_decode(file_get_contents('php://input'));
if (isset($json->SubscribeURL)){
file_get_contents($json->SubscribeURL);
}
file_put_contents("./cron-" . time() . '.txt', json_encode($json));
<?php
namespace App\Http\Requests\Traits;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Validation\ValidationException;
trait FailedValidationTrait
@rodurma
rodurma / gist:9d2a70a15ab4d0004cfdf0665eae2ba4
Created May 19, 2019 15:15
Gestão de contas facebook
- Seu Facebook Business
--- Conta 1
------ Para divulgar o produto A
------ Pixel da conta 1
------ Página A da conta 1
--- Conta 2
------ Para divulgar o produto B
------ Pixel da conta 2
------ Página da conta 2
@rodurma
rodurma / webpack.mix.js
Created February 5, 2019 00:11
Tailwind.js
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const glob = require("glob-all");
const PurgecssPlugin = require("purgecss-webpack-plugin");
class TailwindExtractor {
static extract(content) {
return content.match(/[A-Za-z0-9-_:\/]+/g) || [];
}
}
@rodurma
rodurma / vue.js
Created January 9, 2019 19:12
vue.js
var checkout = new Vue({
el: '#checkout',
data: {
pagseguro : {
toggle : false
},
products : {
toggle : false
},
@rodurma
rodurma / names_names.php
Created January 9, 2019 12:21
Array PHP com estados brasileiros
<?php
$uf = [
'Acre' => 'Acre',
'Alagoas' => 'Alagoas',
'Amapá' => 'Amapá',
'Amazonas' => 'Amazonas',
'Bahia' => 'Bahia',
'Ceará' => 'Ceará',
'Distrito Federal' => 'Distrito Federal',