Skip to content

Instantly share code, notes, and snippets.

View bertolo1988's full-sized avatar
🎯
Focusing

Tiago Bértolo bertolo1988

🎯
Focusing
View GitHub Profile
@bertolo1988
bertolo1988 / compare-object-proporties.js
Last active April 30, 2018 18:12
Util functions that help comparing object properties
/**
* @returns { * } - An object with properties alphabetically sorted
*/
function sortObjectKeys(obj){
let ordered = {}
Object.keys(obj).sort().forEach(key => {
ordered[key] = obj[key];
});
return ordered;
}
@bertolo1988
bertolo1988 / hotjar_exercise.js
Created October 24, 2017 15:56
Write a JavaScript method receiving an array of objects containing name+age+gender, returning everyone between 30 and 40 years old grouped by gender.
function retrievePeople(people) {
function sortByGender(people) {
return people.sort((personA, personB) => {
if (personA.gender > personB.gender) {
return 1;
}
if (personA.gender < personB.gender) {
return -1;
}
return 0;
@bertolo1988
bertolo1988 / coinbase_eth_price_tab_title.js
Last active September 14, 2017 15:16
How to get Ethereum price on the title of a Coinbase.com tab
/*
Unable to find a chrome extension to display ethereum price
on my browser in EUROS, i decided to make a small script to
set the tab title with it every 2 seconds
All you need to do to use this script is to paste it in
your browser console.
*/
window.setInterval(function() {
@bertolo1988
bertolo1988 / LetsEncrypt.md
Created July 30, 2017 00:50 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@bertolo1988
bertolo1988 / functions-vs-no-functions.js
Last active November 25, 2016 19:19
Do functions decrease performance? Answer: No. Notice the extra let obj=[].
var debug = require('debug')('test');
function sum(a, b) {
return a + b;
}
function multiplyTwo(a) {
return a * 2;
}
tiagowtvision@tiagowtvision-ubu-N55SL:~/Code/Github/sticky-notes$ npm run lint
> [email protected] lint /home/tiagowtvision/Code/Github/sticky-notes
> tslint --project '.'
app/app.component.ts[1, 27]: ' should be "
app/app.component.ts[4, 15]: ' should be "
app/app.component.ts[5, 15]: ' should be "
/home/tiagowtvision/Code/Github/sticky-notes/app/notes.service.ts[1, 28]: ' should be "
/home/tiagowtvision/Code/Github/sticky-notes/app/notes.service.ts[2, 22]: ' should be "
import React from 'react';
import ReactDOM from 'react-dom';
import './TodoApp.css';
import classNames from 'classnames';
const TODOS = [
{ priority: 1, completed: false, text: 'Buy socks' },
{ priority: 2, completed: false, text: 'Fix 1€ bug on flight-scrappper' },
{ priority: 1, completed: false, text: 'Buy Jeans' },
app.get('/voice', function(req, res) {
var resp = new twilio.TwimlResponse();
res.writeHead(200, {
'Content-Type': 'text/xml'
});
var phone = req.query.phone;
var userName = req.query.user;
private static int MAX_DRAWS = 150;
private static int STARTING_MONEY = 25;
private static int OBJECTIVE_MONEY = 50;
private static int STARTING_BET = 1;
private static int ROULETTES = 10;
private static int ANALYZED_DRAWS = 7;
Draw 1
RouletteId 0 - 16 6 31 13 2 9 13 26 6 35
RouletteId 1 - 27 10 24 9 8 18 25 10 31 29
MAX_DRAWS = 100
STARTING_MONEY = 25
OBJECTIVE_MONEY = 50
STARTING_BET = 1
ROULETTES = 10
ANALYZED_DRAWS = 4
SESSIONS = 100000
BlindMartingale