Skip to content

Instantly share code, notes, and snippets.

View felippe-regazio's full-sized avatar
Coding

Felippe Regazio felippe-regazio

Coding
View GitHub Profile
@felippe-regazio
felippe-regazio / email-mx-check.js
Created May 17, 2021 14:14
Check DNS MX entries to validate if the domain part of a given email is valid.
const dns = require('dns');
/**
* Mail Exchange (MX) records are DNS records that are necessary for delivering email to your address.
* In simple DNS terms, an MX record is used to tell the world which mail servers accept incoming mail
* for a given domain. So we can use the domain part of any email to check MX records, if there is
* records it means its a valid email service, otherwise is not.
*
* WARNING: By checking the MX Records you dont check if the email is valid or if exists, you check
* if the EMAIL SERVICE is valid and exists. Anyway is a good filter for spammers and avoid waste
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
<?php
function downloadImageFromUrl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
[
{ "id": 0, "name": "Petrobras" },
{ "id": 1, "name": "JBS" },
{ "id": 2, "name": "Vale" },
{ "id": 3, "name": "Raízen" },
{ "id": 4, "name": "Ultrapar" },
{ "id": 5, "name": "Cosan" },
{ "id": 6, "name": "Braskem" },
{ "id": 7, "name": "Atacadão/Carrefour" },
{ "id": 8, "name": "Cervejaria Ambev" },
@felippe-regazio
felippe-regazio / intercept-function.js
Created March 31, 2020 04:28 — forked from tilmanschweitzer/intercept-function.js
Function to intercept functions calls even to nativ functions.
function interceptFunction (object, fnName, options) {
var noop = function () {};
var fnToWrap = object[fnName];
var before = options.before || noop;
var after = options.after || noop;
object[fnName] = function () {
before.apply(this, arguments);
var result = fnToWrap.apply(this, arguments);
after.apply(this, arguments);
/*
-----------------------------------
Emoji - natural display for the web
-----------------------------------
These font face definitions allows to display emoji glyphs intermingled with
arbitrary characters outside emoji unicode blocks.
Usage
@felippe-regazio
felippe-regazio / git-deployment.md
Created November 5, 2019 23:55 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@felippe-regazio
felippe-regazio / git-deployment.md
Created November 5, 2019 23:55 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.