Skip to content

Instantly share code, notes, and snippets.

View tmaiaroto's full-sized avatar

Tom Maiaroto tmaiaroto

View GitHub Profile
@tmaiaroto
tmaiaroto / keybase.md
Created August 4, 2014 18:02
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 August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// 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 August 7, 2015 17:26
Render image to Canvas in Node.js example
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 April 20, 2012 18:12
Lithium Cron Wrapper
<?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 October 20, 2012 22:29 — forked from mbostock/.block
Pie Chart

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 February 21, 2012 16:29
A model class to help you work with some more advanced features of MongoDB using the Lithium PHP framework.
<?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 July 30, 2016 22:29
A Go Commit Hook for Less Future Headaches
#!/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.
#

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

// $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 March 28, 2018 17:23
Go Lambda GeoIP
package main
import (
"github.com/oschwald/geoip2-golang"
"github.com/fatih/structs"
aegis "github.com/tmaiaroto/aegis/framework"
"net"
"context"
"net/url"
"log"