Skip to content

Instantly share code, notes, and snippets.

View JonatanFlores's full-sized avatar

Jonatan Flores JonatanFlores

View GitHub Profile
@JonatanFlores
JonatanFlores / example.com.import.txt
Created October 24, 2022 00:44 — forked from epicserve/example.com.import.txt
Example Terraform file for importing DNS Records from DigitalOcean
digitalocean_domain.example example.com
digitalocean_record.example example.com,<DO ID>
digitalocean_record.fd-gmail-txt example.com,<DO ID>
digitalocean_record.fd-mx["alt1.aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["alt2.aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx2.googlemail.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx3.googlemail.com."] example.com,<DO ID>
digitalocean_record.fd-ns["1"] example.com,<DO ID>
digitalocean_record.fd-ns["2"] example.com,<DO ID>
@JonatanFlores
JonatanFlores / submit.md
Created December 7, 2021 03:07 — forked from tanaikech/submit.md
Transposing Slice From (n x m) To (m x n) for golang

Transposing Slice From (n x m) To (m x n) for golang

This is a sample script for transposing slice from (n x m) to (m x n) for golang.

Script :

package main

import "fmt"

func transpose(slice [][]string) [][]string {

Useful Git commands

This is just stuff that I have put down that I find I use a lot of the time for my own reference.

Latest changes from repo to your machine

$ git pull
@JonatanFlores
JonatanFlores / group-objects-by-property.md
Created September 24, 2021 02:43 — forked from mikaello/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group array of JavaScript objects by keys

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');
@JonatanFlores
JonatanFlores / jsUtility.js
Created August 21, 2021 19:58 — forked from btspoony/jsUtility.js
Some JS Utility functions
var __sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? __sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? __sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? __sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? __sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? __sys.safari = s[1] : 0;
function typeofUndefined(value) {
@JonatanFlores
JonatanFlores / windows-ip-duplicado.md
Created March 7, 2020 14:19
Outro computador desta rede tem o mesmo endereço de IP deste computador.

LINK Original: https://answers.microsoft.com/pt-br/windows/forum/all/erro-de-rede-outro-computador-desta-rede-tem-o/560570dd-8c24-40cf-9da3-6749350b29d0

Entendo que o Windows apresenta a mensagem "outro computador desta rede tem o mesmo endereço IP desta rede..." mesmo não estão ligado a uma rede.

Para sermos mais assertivos qual o tipo de conexão que utiliza?

Recomendo que faça o procedimento abaixo para redefinir as configurações de rede do computador:

  1. Na tela Iniciar digite CMD para abrir à lista de opções no Pesquisar;
@JonatanFlores
JonatanFlores / node_nginx_ssl.md
Created September 24, 2019 19:02 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@JonatanFlores
JonatanFlores / Config.php
Created September 6, 2019 14:25 — forked from treffynnon/Config.php
A PHP class to access a PHP array via dot notation
<?php
namespace Treffynnon;
/**
* A PHP class to access a PHP array via dot notation
* (Agavi http://www.agavi.org was the inspiration).
*
* This was hacked in to an existing codebase hence the
* global config array variable.
@JonatanFlores
JonatanFlores / supervisor-laravel-centos7.md
Last active June 16, 2021 12:43
Configurar Supervisor e Laravel no Centos 7

Configurando supervisor

Remove o supervisor, caso já esteja instalado (OPCIONAL)

$ yum remove supervisor

Atualiza o repositório

@JonatanFlores
JonatanFlores / varexport.php
Last active May 6, 2019 18:00
PHP var_export() with short array syntax (square brackets) indented 4 spaces
<?php
function varexport($expression, $return=FALSE) {
$export = var_export($expression, TRUE);
$export = preg_replace("/^([ ]*)(.*)/m", '$1$1$2', $export);
$array = preg_split("/\r\n|\n|\r/", $export);
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
$export = join(PHP_EOL, array_filter(["["] + $array));
$export = preg_replace('(\d+\s=>\s)', '', $export); // REMOVE THE NUMERIC INDEXES
if ((bool)$return) return $export; else echo $export;
}