Skip to content

Instantly share code, notes, and snippets.

View juliobetta's full-sized avatar
🎧

Julio Betta juliobetta

🎧
View GitHub Profile
@juliobetta
juliobetta / readme.md
Last active July 5, 2016 20:08
Sending emails with gmail's SMTP on a system with IPv6 enabled

Add the following line to /etc/gai.conf...

precedence ::ffff:0:0/96 100

... so that the system gives preference to IPv4, avoiding IPv6 timeout.

@juliobetta
juliobetta / Timeline.jsx
Created August 6, 2016 18:19
Timeline element for React toolbox
import React from 'react';
import compose from 'recompose/compose';
import classNames from 'classnames';
import styles from './styles.scss';
import pure from 'recompose/pure';
const Timeline = ({className, children}) => {
const classes = classNames(className, styles.timeline);
return (<div className={classes}>{children}</div>);
};
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
# https://www.digitalocean.com/community/questions/how-to-change-swap-size-on-ubuntu-14-04
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
sysctl vm.swappiness=10
sysctl vm.vfs_cache_pressure=50
@juliobetta
juliobetta / couchdb.service
Last active July 3, 2018 20:48
Install CouchDB 2.0 Ubuntu 16.04
# /etc/systemd/system/couchdb.service
[Unit]
Description=Couchdb service
After=network.target
[Service]
Type=simple
User=couchdb
ExecStart=/opt/couchdb/bin/couchdb -o /dev/stdout -e /dev/stderr
@juliobetta
juliobetta / style.css
Created September 16, 2017 03:46
Hide scrollbar, keeping the original behavior
.container {
-ms-overflow-style: none; /* IE 10+ */
overflow: -moz-scrollbars-none; /* Firefox */
}
.container::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
@juliobetta
juliobetta / gist:d066c15c6be7d44d5257192021ae14fb
Created September 26, 2017 17:31
Git alias to order tags by version (git 2.3.3+)
git config --global alias.tags "tag --sort version:refname"
@juliobetta
juliobetta / reduce-01.js
Last active September 30, 2017 13:41
Reduce example
const list = [1, 2, 3, 4, 5];
const result = list.reduce((accumulator, item) => {
return accumulator + item;
}, 0);
console.log(result); // 15
const list = [
{
id: "772b70fa-57be-40fc-976a-1123320df94e",
name: "Jupiter"
},
{
id: "cced1a50-19b7-4971-aacc-a732eb5ec64c",
name: "Saturn"
},
{
const filtered = characters.filter(character => character.debut < 1990);
const reduced = characters.reduce((accumulator, character) => {
if(character.debut < 1990) {
return [...accumulator, character];
}
return accumulator;
}, []);
const mapped = characters.map(character => character.name);
const reduced = characters.reduce((accumulator, character) => [...accumulator, character.name], []);
// [
// "Donkey Kong",
// "Captain Falcon",
// "Fox",
// "Kirby",
// "Link"