Skip to content

Instantly share code, notes, and snippets.

Harlow Ward harlow

Block or report user

Report or block harlow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View checkpoint.go
package checkpoint
import (
"log"
"strconv"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
@harlow
harlow / profile.go
Last active Mar 11, 2017
Struct w/ return vals from Aboutme API
View profile.go
// if "name" is returned as `[]` in JSON payload the json.Unmarshal func will panic in Golang
// Name struct {
// GivenName string `json:"givenName"`
// FamilyName string `json:"familyName"`
// Formatted string `json:"formatted"`
// } `json:"name"`
type Profile struct {
ID string `json:"id"`
Hash string `json:"hash"`
RequestHash string `json:"requestHash"`
@harlow
harlow / app_launched_event.rb
Last active Jan 6, 2017
Ruby based ETL pipeline with Iron.io and Redshift
View app_launched_event.rb
# lib/transformers/mixpanel/app_launched_event.rb
module Transformers
module Mixpanel
class AppLaunchEvent
def initialize(data)
@data = data
end
def csv_row
CSV.generate_line(ordinal_transformed_data)
@harlow
harlow / worker-pool.go
Last active Apr 24, 2019
Worker pool to control concurrency and collect results
View worker-pool.go
package main
import (
"fmt"
"sync"
"time"
)
const concurrency = 3
@harlow
harlow / README.md
Last active May 18, 2018
DynamoDB on Travis-CI
View README.md

DynamoDB on Travis-CI

Leverage docker-compose to boot up the service and set a DYNAMODB_URL as an Env var. As described in the AWS Ruby SDK we can pass in a custom endpoint to the client.

client = Aws::DynamoDB::Client.new(endpoint: ENV['DYNAMODB_URL'])
View registration.rb
class Registration
# Make this model play nice with `form_for`. Gives us validations, initialize, etc
include ActiveModel::Model
# Accessors for the fields we are exposing in the form
attr_accessor :email, :password, :zip
# This is an implementation detail of our authentication (Clearance). It's ultimately going to
# sign this object in and that process expects a user object that has these fields available
delegate :remember_token, :id, to: user
@harlow
harlow / cache.go
Created Aug 24, 2016
Golang cache map
View cache.go
package cache
import (
"crypto/sha256"
"encoding/json"
"fmt"
"os"
"sync"
"time"
)
@harlow
harlow / first-name-synonyms.csv
Last active Mar 12, 2019
First name synonyms for Elasticsearch synonym filter
View first-name-synonyms.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 4 columns, instead of 5. in line 1.
aaron,erin,ron,ronnie
abel,ab,abe,eb,ebbie
abiel,ab
abigail,abby,gail,gail,nabby
abner,ab
abraham,ab,abe
abram,ab
adaline,ada,addy,delia,dell,lena
adelaide,addy,adele,dell,della,heidi
adeline,ada,addy,delia,dell,lena
@harlow
harlow / streams_to_firehose.go
Last active May 9, 2018
Golang lambda function to send Streams data to Firehose
View streams_to_firehose.go
package main
import (
"github.com/apex/go-apex"
"github.com/apex/go-apex/kinesis"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/firehose"
)
You can’t perform that action at this time.