Skip to content

Instantly share code, notes, and snippets.

View maxcelos's full-sized avatar
💭
Looking for awesomeness

Marcelo Silva maxcelos

💭
Looking for awesomeness
View GitHub Profile
@maxcelos
maxcelos / macro.md
Created October 4, 2019 20:58 — forked from brunogaspar/macro.md
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@maxcelos
maxcelos / gist:67445c7d210b62d8fbeac0be6e5ac6f5
Last active April 11, 2019 18:32 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<head>
<meta charset="UTF-8">
<title>Site em manutenção</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
@maxcelos
maxcelos / initials.html
Created March 14, 2019 09:17
Automatically creates a initials placeholder from user's name like Trello
<html>
<head>
<title>Trello's-like Name Initials</title>
<style>
[data-letters]:before {
content:attr(data-letters);
display:inline-block;
font-size:1em;
width:2.5em;
height:2.5em;
sudo -u postgres psql -c "CREATE USER some_user WITH ENCRYPTED PASSWORD 'some_password'" -d template1

sudo -u postgres psql -d nominatim -c "GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO some_user"
sudo -u postgres psql -d nominatim -c "ALTER DEFAULT PRIVILEGES FOR USER marcelo IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO some_user;"
@maxcelos
maxcelos / docgen.php
Last active October 4, 2018 12:55
Gera CPF, CNPJ e IMEI via linha de comando
#!/usr/bin/php
<?php
$argv[1] = $argv[1] ?? 'default';
switch ($argv[1]) {
case 'imei':
echo 'IMEI gerado: ' . imeiRandom() . "\n\n";
break;
case 'cpf' :

Processo de Setup de novo servidor Digital Ocean

  1. Atualização
apt update

apt upgrade

@maxcelos
maxcelos / sources.list
Created October 2, 2018 14:12
Source list for a better packages support on Ubuntu 18.04
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
@maxcelos
maxcelos / laravel-download-view-as-doc.md
Created September 24, 2018 18:33
How to download a view as doc in Laravel
// Content variable to be used on view
$someContent = '<h1>Content test</h1>';

// A custom name for the file
$fileName = 'TestDoc';

return response()
            ->view('someview', ['content' => $someContent], 200)
 -&gt;header('Content-Type', 'application/vnd.ms-word')

Job Description

This job consists in a task management system with Google Calendar integration.

Requirements

  • Tasks can be unique or recurrent like: daily, weekly, bi-weekly, monthly and yearly.
  • Recurrent tasks can have a limited number of repeat times or be unlimited.
  • Every task and its instances must appear in user's Google Calendar.
  • User can edit one or more instances of a task in one request
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCxiLRwxlDGsOcxSrCHYG4ix0P1I2QPeiSFPv7Slhuga8cmYbMEVmHMJzE4ueGe2n6DvRnxue1GtNZjjH/uFKiDkIMVJk9k6ws9zCFq9QE/gd1bGXUGzOEtHbWRsxBt8jPsFfkYggG8VH9wd23ILkjyKU/5IZVIjVwooxqhsiVFCyi4Bjerd/X3/qqmbdVlEe1G21gHBVQUYQDNQVSut1YKlwElbWtxkesWP9mNBReFLybNu1qzzRcIQ5ySrmd6OggxSV4dLeIqEd09Ju+HSQbYgG/JRaa/JQaeUFqshhH+KuJU/lo7djqOedS5qna6iG0mSYszNdD+nrt/erk+NqYNccXB6fjdtBAJvNcfeKje3r5zICRC/SkWBjvOGU1NjsQscLt0K/jlFOb2yKV2dV5YxXPDiBmrbmNpSfysqYNCokGOhCpePwUMCvUWMQTENTFMH5wN6CJPHHgTt02hGjzm5fD3KpYbxolTfNZ4SI4hoRhZl/RcwLkFMw6KwWURaEYKfKD0Tp7GIQ5parqoIEEVBKPFyUkqhVDOm+OujUkPPOPmJ6oLx7je10ER5Tx0GnuBINYu0Wsd3uZoc/8WgcaM/lGFeJyfOfBxe/f+nA971FhVoqBoYwBRpYN6q7COVSVPS/MymjeoTZPVej5wMWq53EQcBfZ0zihGr6zxw/cDVw== maxcelos@mac.home