Skip to content

Instantly share code, notes, and snippets.

View tmaiaroto's full-sized avatar

Tom Maiaroto tmaiaroto

View GitHub Profile
tmaiaroto / usc.go
Created November 7, 2014 20:25
Golang map of US state codes : full name
View usc.go
// 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 / virtual.conf
Created August 9, 2012 18:48
Nginx Virtual Host Setup for OS X using Homebrew
View virtual.conf
# A virtual host using mix of IP-, name-, and port-based configuration.
# This is based on using Homebrew for OS X. You can use this in other
# cases though, but you'll likely need to adjust some of the paths below.
server {
# Replace this port with the right one for your requirements
# listen 80 [default|default_server]; #could also be
tmaiaroto / Dockerfile
Last active June 30, 2022 08:48
WordPress on Amazon ECS
View Dockerfile
FROM alpine:3.3
MAINTAINER Tom Maiaroto <>
# Install packages
RUN apk --update --repository add \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
php7 \
tmaiaroto /
Last active May 23, 2022 12:29
JSON Based Hypermedia Structures - Notes & Comparisons

Collection+JSON format

This format takes into consideration collections (much like Siren). It also takes into consideration versioning. However, I'm not certain version matters in the data set if it pertains to an API version. That is best left being in the API URL. It could pertain to collection version, but I'm not sure the point. Documentation says each collection should have a version - but says nothing more about meaning or why.

Items are clearly distinct in this format and are organizationally positioned separate from links.
This is by far the most collision free structure.

However, the data format itself is a bit strange...Every field being an array. Data is always an array of objects. I understand the flexibility this presents and am not 100% against it. I just believe it's perhaps not needed as things could change based on the client application.

tmaiaroto / image-proxy.conf
Last active December 16, 2021 03:23
Nginx Image Filter Resize Proxy Service
View image-proxy.conf
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
tmaiaroto / Gruntfile.js
Created July 2, 2015 15:34
Gruntfile for working with Hugo
View Gruntfile.js
module.exports = function(grunt) {
shell: {
options: {
stdout: true
server: {
View google_twunter_lol
tmaiaroto / get_raw_sql.ts
Created June 24, 2020 01:04 — forked from slavivanov/get_raw_sql.ts
Get generated SQL query from Sequelize
View get_raw_sql.ts
import * as Sequelize from "sequelize";
import uuidv1 = require("uuid/v4");
import { SequelizeModelStatic } from "./sequelize";
import * as pLimit from "p-limit";
import _ = require("lodash");
* Get generated SQL query from sequelize. Returns a promise that:
* 1. Adds a hook that receives the prepared options from Sequelize
* - Since hooks work on the whole model,
tmaiaroto / getIEVersion.js
Created June 17, 2020 20:32
Detect IE Version
View getIEVersion.js
// Looks at User Agent to determine if IE and which version
function GetIEVersion() {
var sAgent = window.navigator.userAgent;
var idx = sAgent.indexOf("MSIE");
var versionNumber = 0;
// If IE, return version number.
if (idx) {
try {
versionNumber = parseInt(sAgent.substring(idx+ 5, sAgent.indexOf(".", idx)));
tmaiaroto / material-ui-flexible-fixed-header-table.js
Created March 16, 2020 23:22 — forked from antonfisher/material-ui-flexible-fixed-header-table.js
React.js Material-UI Table component with flexible height and fixed header
View material-ui-flexible-fixed-header-table.js
* React.js Material-UI Table and TableRow components with flexible height and fixed header
* - fixes "jumping" scrolling bar in WebKit browsers
* - shows permanent scrolling bar for other browsers
* Usage: import this Table and TableRow component instead of
* 'material-ui/Table' and 'material-ui/TableRow' component
import React, {PropTypes} from 'react';