Skip to content

Instantly share code, notes, and snippets.

View nathanows's full-sized avatar

Nathan Owsiany nathanows

  • Denver, CO
View GitHub Profile
@nathanows
nathanows / braille_letters.rb
Created October 20, 2015 15:06
Braille Letters
require 'pry'
class FileReader
def self.input_filename
ARGV[0]
end
def read
filename = FileReader.input_filename
File.read(filename)
@nathanows
nathanows / gist:5978f404bfac6b54d8ab
Last active August 29, 2015 14:18
Flexible Data Storage Lightning Talk Outline

#Flexible Data Storage: Polymorphism, and Serialization, and HStore, oh my!

###Story/Example App

  • Sample app showing an example use case
  • User profile with an unlimited number of custom attributes

###Question: How would you setup your database to record this information?

###Options

  • Polymorphism (1 sentence overview)
@nathanows
nathanows / gist:69277054e9ba7fdb3b2d
Last active August 29, 2015 14:18
Jet Fuel Notes

API Endpoints (/api/v1/...)

  • /poverty/map(?year=2014) (state geo.json data with any coloring/shading options applied (maybe a color intensity?)
  • /poverty/markers(?year=2014) (any individual points or markers we want on/in the states, possible year filter)
  • /poverty (general data set information (data set name, updated_at, avail. years, etc))
  • /poverty/state/tweets (last 50 tweets within predefined poverty twitter hashtags) OR /poverty/tweets?state=XX
  • /poverty/state/tweets/sentiment (sentiment scale score of last 2000 tweets)
  • /poverty/state/data(?year-2014) (more chosen state data, for example actual numbers/%'s, that could be overlaid on state)
  • /poverty/state/images (if we wanted to pull in instagram photos)
@nathanows
nathanows / gist:97ea304c97eef41d2f5c
Created March 16, 2015 17:41
RSpec: Testing Token/API Key Authentication (with results scoped to current user)
##
## TOKEN/API KEY AUTHENTICATION
## This was based on blogger-advanced
## Continuing from the class we built this in...
## if not already done, you'll need to make an ApiKey table in the DB 'rails g model ApiKey token:string'
## Add a new column to the ApiKey table to associate a key with an author
## 'rails g migration add-author-to-api-key author:references'
##
# app/controllers/application_controller.rb
@nathanows
nathanows / gist:b7dde50423d6ceb822ab
Created March 16, 2015 17:24
RSpec: Testing HTTP:Basic Authentication
##
## HTTP:Basic AUTHENTICATION
## This was based on blogger-advanced
## Continuing from the class we built this in...
##
# app/controllers/api/v1/articles_controller.rb
class Api::V1::ArticlesController < ApplicationController
#...
before_action :authenticate
@nathanows
nathanows / gist:b5346256b06d8ce61f8e
Last active November 3, 2022 09:34
RSpec: Testing Token/API Key Authentication
##
## TOKEN/API KEY AUTHENTICATION
## This was based on blogger-advanced
## Continuing from the class we built this in...
## if not already done, you'll need to make an ApiKey table in the DB 'rails g model ApiKey token:string'
##
# app/controllers/api/v1/articles_controller.rb
class Api::V1::ArticlesController < ApplicationController
#...
@nathanows
nathanows / gist:e88a491e8ebb979e5408
Created February 25, 2015 05:46
Ruby Microframeworks

##Ruby Microframeworks for Web Development

  1. What is a web framework?
  • Brief intro
  • Across languages (Rails, Django, etc.)
  1. Rails The not-so-micro-framework
  • Rails
  • Rails upsides and downsides
  1. What is a microframework?
  • Sinatra (ruby darling, prob 2nd most well known)
  • Includes DSL's