Skip to content

Instantly share code, notes, and snippets.

:octocat:
Learning and sharing.

Emerson Carvalho emersonbroga

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

#Front-end Timezone with javascript

Dependencies:

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}`;
View README.md

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
emersonbroga / README.md
Last active Nov 25, 2018
Coordinates from adrress with NodeJs and Google Maps
View README.md

Coordinates from adrress with NodeJs and Google Maps

How to run

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

Bitcoin Price

How to run

npm install --save request
node bitcoin-price.js
@emersonbroga
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
emersonbroga / README.md
Last active Aug 29, 2017
Wordpress + Mailgun
View README.md

Wordpress + Mailgun

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

Installation

. Install the mailgun plugin for wordrpess https://wordpress.org/plugins/mailgun/

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

View index.html
<!DOCTYPE html>
<html>
<head>
<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
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
emersonbroga / smoothScroll.js
Created Feb 27, 2017
SmoothScroll without jquery.
View smoothScroll.js
var smoothScroll = {
timer: null,
stop: function () {
clearTimeout(this.timer);
},
scrollTo: function (id, callback) {
var settings = {
duration: 1000,
You can’t perform that action at this time.