Skip to content

Instantly share code, notes, and snippets.

View oieduardorabelo's full-sized avatar

Eduardo Rabelo oieduardorabelo

View GitHub Profile
@oieduardorabelo
oieduardorabelo / installing-postgresql.md
Last active January 4, 2023 10:19
Installing PostgreSQL on Ubuntu with UTF-8 database template

Para instalar a versão mais atualizada do PostgreSQL, adicione o Apt Repository oficial:

echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' | sudo tee /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update
@oieduardorabelo
oieduardorabelo / installing-node-js.md
Created February 18, 2014 00:30
Installing Node.js with a up-to-date ppa
Ubuntu
sudo apt-get update

sudo apt-get install -y python-software-properties python g++ make

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get update
@oieduardorabelo
oieduardorabelo / apt-get-remove.md
Last active August 29, 2015 13:56
A snippet about how you can remove a package installed via apt-get

Removing package installed via apt-get

sudo apt-get remove --purge <package-name>
sudo apt-get autoremove
sudo apt-get autoclean

Simple example:

@oieduardorabelo
oieduardorabelo / ai-export-layers.jsx
Created November 16, 2015 04:29
AI - Export Layers as Images
#target Illustrator
// script.name = exportLayersAsCSS_PNGs.jsx;
// script.description = mimics the Save for Web, export images as CSS Layers (images only);
// script.requirements = an open document; tested with CS5 on Windows.
// script.parent = carlos canto // 05/24/13; All rights reseved
// script.elegant = false;
/**
<UserImage user={user} width={50} height={30} variant="small" />
^^^^^^^ number. This type is incompatible with void
<UserImage user={user} width={50} height={30} variant="small" />
^^^^^^^ number. This type is incompatible with void
<UserImage user={user} width={50} height={30} variant="small" />
^^^^^^^ string. This type is incompatible with void
// Examples
export class App extends Component {
render() {
return (
<main>
<Spacer type="small">
<p>Hello dude!</p>
</Spacer>
<Spacer type="medium">
<div>
@oieduardorabelo
oieduardorabelo / redux-utils.js
Last active March 17, 2017 00:11
Signals and Actions helper for Redux/Redux-Saga
// We can replace here by `redux-actions`
const createActionCreator = function(action) {
return function(data) {
return {
type: action,
payload: data,
}
}
}
const superagent = require('superagent');
const NUM_RETRIES = 3;
request('http://google.com/this-throws-an-error', function(error, res) {
console.log(error.message); // "Not Found"
});
function request(url, callback) {
_request(url, 0, callback);
const superagent = require('superagent');
const NUM_RETRIES = 3;
test();
async function test() {
let i;
for (i = 0; i < NUM_RETRIES; ++i) {
try {
const superagent = require('superagent');
const NUM_RETRIES = 3;
test();
async function test() {
let arr = new Array(NUM_RETRIES).map(() => null);
arr.forEach(() => {
try {