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 / 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.

/*
-----------------------------------
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 / 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);
[
{ "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" },
<?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);
# 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\]"
@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
# use this command to add 5-seconds delay to the audio track of a video
#
ffmpeg -i input.mp4 -itsoffset 5 -i input.mp4 -map 0:v -map 1:a -vcodec copy -acodec copy delayed.mp4
@felippe-regazio
felippe-regazio / package.json
Created July 15, 2021 03:38 — forked from jayphelps/package.json
TypeScript output es2015, esm (ES Modules), CJS, UMD, UMD + Min + Gzip. Assumes you install typescript (tsc), rollup, uglifyjs either globally or included as devDependencies
{
"scripts": {
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min",
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js",
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz",
}
}