Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Maiaroto tmaiaroto

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am tmaiaroto on github.
  • I am tom_m (https://keybase.io/tom_m) on keybase.
  • I have a public key whose fingerprint is 5948 CBF7 08F2 5DD6 A8E4 2AAC 051A CEFF 7F30 0462

To claim this, I am signing this object:

@tmaiaroto
tmaiaroto / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tmaiaroto
tmaiaroto / image-to-canvas.js
Created Aug 7, 2015
Render image to Canvas in Node.js example
View image-to-canvas.js
request({url: opts.url, method: 'GET', headers: { 'user-agent': opts.userAgent}, encoding: null}, function (error, response, body) {
if(!error && response.statusCode == 200) {
var img = new Image
, canvas = new Canvas
, ctx = canvas.getContext('2d');
img.onload = function() {
canvas.width = img.width;
canvas.height = img.height;
ctx.fillStyle = 'white';
@tmaiaroto
tmaiaroto / cron.php
Created Apr 20, 2012
Lithium Cron Wrapper
View cron.php
<?php
/**
* This script is meant to be executed via crontab.
* It should help you easily set li3 commands as cron jobs.
*
* You should put this in the root of your application.
* However, you don't need to, but you would then need to
* pass a --path= option with the path to your app.
* This is because the li3 console command must be called
* from a specific location.
@tmaiaroto
tmaiaroto / README.md
Created Oct 20, 2012 — forked from mbostock/.block
Pie Chart
View README.md

This pie chart is constructed from a CSV file storing the populations of various age groups. The chart employs a number of D3 features:

@tmaiaroto
tmaiaroto / System.php
Created Feb 21, 2012
A model class to help you work with some more advanced features of MongoDB using the Lithium PHP framework.
View System.php
<?php
/**
* A System model to work with MongoDB from a higher level.
* This model will executes various commands as well as store new commands.
* The system.js collection is used.
*
* Warning: There be dragons in here.
*
*/
namespace app\models;
@tmaiaroto
tmaiaroto / pre-commit
Last active Jul 30, 2016
A Go Commit Hook for Less Future Headaches
View pre-commit
#!/bin/bash
#
# Check a "few" things to help write more maintainable Go code.
#
# OK, it's fairly comprehensive. So simply remove or comment out
# anything you don't want.
#
# Don't forget to install (go get) each of these tools.
# More info at the URLs provided.
#
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

View _baseline.scss
// $base-font-size: 16px; // not sure this ever did anything
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@tmaiaroto
tmaiaroto / main.go
Created Mar 28, 2018
Go Lambda GeoIP
View main.go
package main
import (
"github.com/oschwald/geoip2-golang"
"github.com/fatih/structs"
aegis "github.com/tmaiaroto/aegis/framework"
"net"
"context"
"net/url"
"log"