This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slick.dbs.default.driver="slick.driver.PostgresDriver$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := """steel""" | |
version := "1.0-SNAPSHOT" | |
lazy val root = (project in file(".")).enablePlugins(PlayScala) | |
scalaVersion := "2.11.5" | |
resolvers ++= Seq( | |
"Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/", | |
"Typesafe Maven Repository" at "http://repo.typesafe.com/typesafe/maven-releases/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scenario: | |
# We run a youtube production company and we make videos for paying members. | |
# Paying members can likewise access paid for premium content, and guests can access free content. | |
# Pretty straight forward. | |
# | |
# Next Scenario: | |
# We decide, one day, to open source all of our content. All videos, text posts, tutorials, etc | |
# are now available to *all* users. | |
# | |
# What's the most optimal way to be able to ship such a feature, with all tests passing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if params[:q] %> | |
<% if @results.formatter.formatted_results.any? %> | |
<div class="search-results"> | |
<% @results.formatter.formatted_results.each do |r| %> | |
<div class="blog-post"> | |
<div><%= link_to r[:title].html_safe, post_path(r[:id]) %></div> | |
<div class="blog-post-meta"> | |
by <%= link_to User.find(r[:user_id]).name, user_path(r[:user_id]) %> | |
on <%= r[:published_on] %> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchController < ApplicationController | |
def index | |
@results = [] | |
if params[:q] | |
@results = Post.search(params.to_h) | |
respond_to do |format| | |
format.html { render action: "index" } | |
format.json { render json: @results } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
include PgSearch | |
include Search | |
# ... | |
scope :with_author, -> { eager_load(:user) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fluorescent' | |
require 'pp' | |
module Search | |
class Result | |
attr_reader :formatter, :raw | |
def initialize args | |
@formatter = Fluorescent.new(args) | |
@raw = args[:results] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fluorescent' | |
module Search | |
class Result | |
attr_reader :formatter, :raw | |
def initialize args | |
@formatter = Fluorescent.new(args) | |
@raw = args[:results] | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/ | |
github.com/golang/example/ | |
.git/ # Git repository metadata | |
stringutil/ | |
reverse.go # package source | |
reverse_test.go # test source | |
app/ | |
main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin/ | |
hello # command executable | |
outyet # command executable | |
pkg/ | |
linux_amd64/ | |
github.com/golang/example/ | |
stringutil.a # package object | |
src/ | |
github.com/golang/example/ | |
.git/ # Git repository metadata |