Skip to content

Instantly share code, notes, and snippets.

Learning and sharing.

Emerson Carvalho emersonbroga

View GitHub Profile
emersonbroga /
Created Feb 14, 2019
Front-end Javascript: Get a specific date/time from a defined Timezone.

#Front-end Timezone with javascript


date-fns date-fns-timezone

##How to Run:

View carbon-test.js
// bad
let name = 'Emerson Broga';
let hello = 'Hello ' + name;
// good
let name = 'Emerson Broga'
let hello = `Hello ${name}`;

Coordinates from adrress with Javascript and Google Maps

How to run

open coordinates-axios.html or coordinates-jquery.html in your browser.

Blog Post

emersonbroga /
Last active Nov 25, 2018
Coordinates from adrress with NodeJs and Google Maps

Coordinates from adrress with NodeJs and Google Maps

How to run

npm install --save request
node coordinates.js
emersonbroga /
Last active Nov 25, 2018
Bitcoin value with Javascript

Bitcoin Price

How to run

npm install --save request
node bitcoin-price.js
emersonbroga / logger.js
Created Sep 25, 2018
Simple JS Logger that logs to a TXT file.
View logger.js
const fs = require('fs');
const path = require('path');
const DEFAULT_PATH = './output/log.txt';
const getAbsolutePath = (filePath) => {
const absolutePath = path.resolve(filePath);
const fileExists = fs.existsSync(absolutePath);
if (!fileExists) {
throw new Error(`File doesn't exist: ${absolutePath}`);
emersonbroga /
Last active Aug 29, 2017
Wordpress + Mailgun

Wordpress + Mailgun

This is a simple snippet to create a wordpress contact form that sends email using mailgun api.


. Install the mailgun plugin for wordrpess

. Add the config constants to your wp-config.php

View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
input {
height: 30px;
width: 50%;
emersonbroga / gist:619084f79f21a0e97bbc343fb6c52cdf
Created Feb 27, 2017
Check if element is visible (in view)
View gist:619084f79f21a0e97bbc343fb6c52cdf
function Utils() {}
Utils.prototype = {
constructor: Utils,
isElementInView: function (element, fullyInView) {
var pageTop = $(window).scrollTop();
var pageBottom = pageTop + $(window).height();
var elementTop = $(element).offset().top;
var elementBottom = elementTop + $(element).height();
emersonbroga / smoothScroll.js
Created Feb 27, 2017
SmoothScroll without jquery.
View smoothScroll.js
var smoothScroll = {
timer: null,
stop: function () {
scrollTo: function (id, callback) {
var settings = {
duration: 1000,
You can’t perform that action at this time.