Skip to content

Instantly share code, notes, and snippets.

:octocat:
Let's code!

Emerson Carvalho emersonbroga

:octocat:
Let's code!
View GitHub Profile
@emersonbroga
emersonbroga / Readme.md
Last active Jul 19, 2020
Convert images from CR2 to JPG.
View Readme.md

Conversor de imagens de CR2 para JPG

instruções

salve o código como index.js crie uma pasta chamada CR2 adicione os seus arquivos CR2 la crie uma pasta chamada JPG e deixe ela vazia abra o seu terminal e rode npm install --save cr2-raw depois rode node index.js

View asyncLoop.js
function asyncLoop(iterations, func, callback) {
var index = 0;
var done = false;
var loop = {
next: function() {
if (done) {
return;
}
if (index < iterations) {
View GoogleTrendsService.js
const Parser = require('rss-parser');
const parseVolumeToInt = volume => {
const vol = volume.replace('+', '').replace(',', '');
return Number.parseInt(vol, 10);
};
async function getGoogleTrends(url) {
const parser = new Parser({
defaultRSS: 2.0,
@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

You can’t perform that action at this time.