Mix.install([:flame, :plug, :req])defmodule Server do
| defmodule Parser do | |
| import NimbleParsec | |
| game_id = ignore(string("Game ")) |> integer(min: 1, max: 4) |> unwrap_and_tag(:id) | |
| red = replace(string("red"), :red) | |
| green = replace(string("green"), :green) | |
| blue = replace(string("blue"), :blue) | |
| color = choice([red, green, blue]) | 
| defmodule Replacer do | |
| import NimbleParsec | |
| one = string("o") |> lookahead(string("ne")) |> replace("1") | |
| two = string("t") |> lookahead(string("wo")) |> replace("2") | |
| three = string("t") |> lookahead(string("hree")) |> replace("3") | |
| four = string("f") |> lookahead(string("our")) |> replace("4") | |
| five = string("f") |> lookahead(string("ive")) |> replace("5") | |
| six = string("s") |> lookahead(string("ix")) |> replace("6") | |
| seven = string("s") |> lookahead(string("even")) |> replace("7") | |
| eight = string("e") |> lookahead(string("ight")) |> replace("8") | 
| signing_salt = :crypto.strong_rand_bytes(8) |> Base.encode16() | |
| secret_base = :crypto.strong_rand_bytes(32) |> Base.encode16() | |
| Application.put_env(:phoenix, :json_library, Jason) | |
| Application.put_env(:sample, SamplePhoenix.Endpoint, | |
| adapter: Bandit.PhoenixAdapter, | |
| http: [ | |
| ip: {127, 0, 0, 1}, | |
| port: String.to_integer(System.get_env("PORT") || "4000") | 
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| didInsertElement: function() { | |
| this._super(); | |
| this.player = videojs(this.$('video')[0], null, function() { | |
| this.play(); | |
| }); | |
| }, | |
| didRender: function() { | 
| #! /usr/bin/env ruby | |
| require 'bundler/inline' | |
| gemfile do | |
| gem 'rspec', '3.7', require: false | |
| end | |
| class Program | |
| def initialize(input) | 
| $ chmod +x wc.rb | |
| $ echo "hello, world" | ./wc.rb | |
| 1 2 13 | |
| $ printf "line 1\nline 2\n" | ./wc.rb | |
| 2 4 14 | 
| $ rspec wc.rb | |
| .... | |
| Finished in 0.00348 seconds (files took 0.19061 seconds to load) | |
| 4 examples, 0 failures | 
| # script logic | |
| if $PROGRAM_NAME == __FILE__ | |
| # the script itself is being executed | |
| exit | |
| end | |
| require 'rspec' | |
| RSpec.describe 'the script' do | 
| require 'bundler/inline' | |
| gemfile do | |
| gem 'rspec', '3.7', require: false | |
| end |