Skip to content

Instantly share code, notes, and snippets.

View leandrojo's full-sized avatar
🎯
Focusing

Leandro Araújo leandrojo

🎯
Focusing
  • São Paulo, Brasil
View GitHub Profile
@JedWatson
JedWatson / KeystoneApiExample.md
Last active July 26, 2021 11:29
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@cleuton
cleuton / balanceador.js
Created April 8, 2014 15:51
Naive load balancer written in Node.js
// balanceador de carga
var http = require('http');
// npm install http-proxy
var http_proxy = require('http-proxy');
var proxServer = 0;
var servidores = [
{'url':'http://localhost:8085'},
{'url':'http://localhost:8090'},
@ideaoforder
ideaoforder / godaddy-ssl-howto
Created April 8, 2014 16:30
GoDaddy + Nginx SSL
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
http://support.godaddy.com/help/article/3601/generating-a-certificate-signing-request-nginx
http://support.godaddy.com/help/article/4976/rekeying-an-ssl-certificate
# Be sure to remember to chain them!
cat gd_bundle-g2-g1.crt >> yourdomain.crt
# Move 'em
sudo mv yourdomain.crt /etc/ssl/certs/yourdomain.crt
@johnbintz
johnbintz / simple-capistrano-docker-deploy.rb
Last active June 6, 2025 20:51
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@RinatMullayanov
RinatMullayanov / Dockerfile
Last active August 1, 2023 22:13
Ubuntu Node.js Dockerfile
#
# Ubuntu Node.js Dockerfile
#
# https://github.com/dockerfile/ubuntu/blob/master/Dockerfile
# https://docs.docker.com/examples/nodejs_web_app/
#
# Pull base image.
FROM ubuntu:14.04
@rmtsrc
rmtsrc / postgres-json-cheatsheet.md
Last active June 7, 2024 05:21
Using JSON in Postgres by example

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
public class Hello
{
   public static void Main()
   {
-      System.Console.WriteLine("Hello, World!");
+      System.Console.WriteLine("Rock all night long!");
   }
}
@Pompeu
Pompeu / cpf_consulta_api_sus.js
Last active August 6, 2026 17:41
cpf_consulta_api_sus.js
'use strict';
// @deprecade
const http = require('http');
const cpf = process.argv[2];
const parse = JSON.parse;
const log = console.log;
const url = `http://dabsistemas.saude.gov.br/sistemas/sadab/js/buscar_cpf_dbpessoa.json.php?cpf=${cpf}`;
http.get(url, res => {
@cyberglot
cyberglot / retro2016.md
Last active June 8, 2019 21:24
tentando ver o lado bom de 2016...

2016 em retrospecto

2016 não foi um ano bom, em geral. Entretanto, esse foi um ano que eu considero especialmente bom na minha vida.

Tech

  • 2015 foi um ano desastroso pra mim, comecei 2016 com aviso prévio na Podio, que tava demitindo em massa todo mundo do escritório de Copenhagen. Felizmente, já na primeira semana de Janeiro, consegui uma oferta da Opbeat - que é definitivamente o produto mais interessante que já trabalhei.
  • Em Abril, larguei a Opbeat (como dev em tempo integral), para começar o doutorado em Ciência da Computação na Universidade de Roskilde. Algo que eu ensaiava fazer há muito tempo, que era me distanciar de JavaScript e desenvolvimento frontend para me dedicar à Programação Funcional e Teoria de Tipos, em um nível acadêmico.
  • Aprendi Teoria de Tipos, inclusive a implementar checadores de tipos até System F. Sei como tipos dependentes e de refinamento funcionam, embora não tenha uma visão clara de como implementá-los (2017 spoiler). Também aprendi "tipos