Skip to content

Instantly share code, notes, and snippets.

View tmaiaroto's full-sized avatar

Tom Maiaroto tmaiaroto

View GitHub Profile
@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.
#
@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 / Gruntfile.js
Created July 2, 2015 15:34
Gruntfile for working with Hugo
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
shell: {
options: {
stdout: true
},
server: {

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) {
4r5e
5h1t
5hit
a55
anal
anus
ar5e
arrse
arse
ass
@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 / upperlower.go
Created November 9, 2014 04:53
Golang: somewhat faster string uppercase / lowercase (for certain strings)
// See: https://groups.google.com/forum/#!topic/golang-nuts/Il2DX4xpW3w
// A slightly faster lowercase function.
func toLower(s string) string {
b := make([]byte, len(s))
for i := range b {
c := s[i]
if c >= 'A' && c <= 'Z' {
c += 'a' - 'A'
}
@tmaiaroto
tmaiaroto / usc.go
Created November 7, 2014 20:25
Golang map of US state codes : full name
// A handy map of US state codes to full names
var usc = map[string]string{
"AL": "Alabama",
"AK": "Alaska",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
@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: