Skip to content

Instantly share code, notes, and snippets.

Avatar
😆

Igor C. de Paula IgorDePaula

😆
View GitHub Profile
@IgorDePaula
IgorDePaula / Random-string
Created Jan 20, 2021 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
View Random-string
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
View Click.vue
<template>
<div class="btn-classic">
oid
</div>
</template>
<script>
export default {
name: "Click"
}
@IgorDePaula
IgorDePaula / Rabbitmq.php
Last active Jan 12, 2021
Rabbitmq service
View Rabbitmq.php
<?php
namespace App\Services;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
class Rabbitmq
@IgorDePaula
IgorDePaula / DockerFileEchoServer
Last active Feb 19, 2021
Laravel com redis e laravel-echo-server
View DockerFileEchoServer
# .docker/echo/Dockerfile
FROM node:erbium-alpine3.10
RUN npm install -g laravel-echo-server
RUN mkdir -p /var/www
WORKDIR /var/www
EXPOSE 6001
RUN ls /var/www
ENTRYPOINT laravel-echo-server start
@IgorDePaula
IgorDePaula / laravel.json
Last active Dec 27, 2020
Packer file to laravel on digital ocean
View laravel.json
{
"variables": {
"do_api_token": "*******"
},
"builders": [
{
"type": "digitalocean",
"api_token": "{{user `do_api_token`}}",
"image": "ubuntu-20-04-x64",
"region": "nyc3",
View collection.php
<?php
$items = [];
foreach ($products as $value) {
$items[] = [
'product_id' => $value->id,
'name' => $value->name,
];
}
return collect($items)->all();
View HospitalController.php
<?php
...
class HospitalCnotroller{
public function index(Request $request){
$hospitas = Hospital::all()->pluck('nome','id');
$dados = Servidor::where('hospital',$request->hospital)->paginate();
return view('servidores',['dados'=>$dados,'hospital'=>$hospital,'hospitais'=>$hospitais]);
}
}
View TypeValidator.js
export default (type) => ['success', 'info', 'danger', 'warning'].indexOf(type) > -1
@IgorDePaula
IgorDePaula / Checkbox.js
Created Sep 21, 2020
Checkbox com vue and tailwindcss
View Checkbox.js
const Checkbox = {
name: 'Checkbox',
template: '<div>' +
'<div class="input-text cursor-pointer flex h-10" @click="emit">' +
'<div class="h-4 w-4 rounded border-2 border-green-700 m-auto" :class="newClass">' +
'<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 fill-current text-white" v-if="checked" viewBox="0 0 20 20"><path d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>' +
'</div>' +
'<div class="self-center flex-1 px-1 pb-1" v-html="label"></div>' +
'</div>' +
'</div>',
@IgorDePaula
IgorDePaula / RadioButton.js
Last active Sep 18, 2020
Radio Button puro em vuejs e tailwindcss (classe input-text é um conjunto add com ```@apply``` do tailwindcss)
View RadioButton.js
const RadioButton = {
name: 'RadioButton',
template: '<div>' +
'<div class="input-text cursor-pointer flex h-10" @click="$emit(\'input\', valor)">' +
'<div class="h-4 w-4 rounded-full border-2 border-green-700 m-auto" :class="newClass">' +
'<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 fill-current text-white" v-if="checked == valor" viewBox="0 0 20 20"><path d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>' +
'</div>' +
'<div class="self-center flex-1 px-2 pb-1">{{label}}</div>' +
'</div>',
computed: {