"
19 | end
20 |
21 | def name
22 | "#{first_name} #{last_name}"
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/application/show.html.haml:
--------------------------------------------------------------------------------
1 | - icon_remove = ''.html_safe
2 |
3 | - pill 'admin.actions.edit'.t, controller.resource_path(:edit) if can? :edit, resource
4 |
5 | - pill icon_remove + 'admin.actions.destroy'.t, controller.resource_path(:destroy), method: :delete, confirm: 'confirm.default'.t, class: 'red' if can? :delete, resource
6 |
7 | - breadcrumb resource_class.model_name.human.pluralize(I18n.locale), controller.resource_path(:index)
8 | - breadcrumb resource_label
9 |
10 |
11 | - content_for :before_content do
12 | = breadcrumbs
13 |
14 | - content_for :content_header do
15 | = pills
16 |
17 | = render 'show'
18 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/admin/application.css.sass:
--------------------------------------------------------------------------------
1 | @import compass
2 |
3 | @import ../lib/normalize
4 | @import ../lib/purecss
5 |
6 | @import ../common/colors
7 | @import ../common/variables
8 | @import ../common/mixins
9 | @import ../common/fonts
10 |
11 | @import ../partials/buttons
12 | @import ../partials/inputs
13 | @import ../partials/breadcrumbs
14 | @import ../partials/pills
15 | @import ../partials/badges
16 | @import ../partials/navigation
17 | @import ../partials/session
18 | @import ../partials/flashes
19 | @import ../partials/lists
20 | @import ../partials/collections
21 | @import ../partials/kaminari
22 | @import ../partials/cards
23 | @import ../styles
24 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ### 0.5.0 -- 2/15/16
3 | Update sloc package to version 0.1.10
4 | (thanks ejmsoftware)
5 |
6 | ### 0.4.0 -- 1/5/16
7 | respect .gitignore
8 |
9 | ### 0.3.9 -- 1/5/16
10 | added twig
11 |
12 | ### 0.3.6 -- 1/4/16
13 | added jade
14 |
15 | ### 0.3.5 -- 6/22/15
16 | fixed type in readme
17 |
18 | ### 0.3.4 -- 6/4/15
19 | more deprecations
20 |
21 | ### 0.3.3 -- 5/26/15
22 | selectors
23 |
24 | ### 0.3.2 -- 5/25/15
25 | style deprecations
26 |
27 | ### 0.3.1 -- 5/25/15
28 | fixed more deprecations
29 |
30 | ### 0.3.0
31 |
32 | fixed deprecations
33 | Ignore bower_components.
34 |
35 | ### 0.2.0
36 | Added CHANGELOG.md
37 | added C++ file extensions (thanks @Liamsi)
38 |
--------------------------------------------------------------------------------
/test/exoplanets/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery with: :exception
3 | rescue_traffic
4 |
5 | def self.resource_name
6 | self.name.gsub('Controller', '').split('::').last.underscore
7 | end
8 |
9 | def after_sign_in_path_for(resource)
10 | if resource.roles.empty?
11 | params[:redirect] || super
12 | else
13 | params[:redirect] || admin_root_path
14 | end
15 | end
16 |
17 | def after_sign_up_path_for(resource)
18 | params[:redirect] || super
19 | end
20 |
21 | def resource_params
22 | params.require(resource_name).permit!
23 | end
24 |
25 | def controller_scope
26 | []
27 | end
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/pixi_boot.js.coffee:
--------------------------------------------------------------------------------
1 | #= require pixi.dev
2 | #= require ./planets/utils
3 |
4 | WIDTH = 400
5 | HEIGHT = 300
6 |
7 | playing = false
8 |
9 |
10 | $ ->
11 | $canvas = $('#canvas')
12 | $stage = $('#stage')
13 |
14 | stage = new PIXI.Stage(0x000000)
15 |
16 | renderer = PIXI.autoDetectRenderer(WIDTH, HEIGHT)
17 |
18 | $stage.append(renderer.view)
19 |
20 | texture = PIXI.Texture.fromImage('images/0.png')
21 | planet = new PIXI.Sprite(texture)
22 |
23 | planet.position.x = 0
24 | planet.position.y = 0
25 |
26 | stage.addChild planet
27 |
28 | window.animate = ->
29 | renderer.render(stage)
30 | setTimeout (-> requestAnimationFrame animate if playing), 0
31 |
32 | animate()
33 |
--------------------------------------------------------------------------------
/test/exoplanets/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/test/exoplanets/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure your secret_key_base is kept private
11 | # if you're sharing your code publicly.
12 | Exoplanets::Application.config.secret_key_base = 'fd8d02c40a668c0818bad4c82670ea36208b8f7e3e84e0434ea3da72ab560ee373a80498cae9a23a67a4a0cfd350c8937b326a641fa4bb44f2fe028d0c72b95b'
13 |
--------------------------------------------------------------------------------
/test/exoplanets/app/uploaders/planet_surface_uploader.rb:
--------------------------------------------------------------------------------
1 | # encoding: utf-8
2 |
3 | class PlanetSurfaceUploader < CarrierWave::Uploader::Base
4 | include CarrierWave::RMagick
5 | include CarrierWave::Meta
6 |
7 | process store_meta: [{md5sum: true}]
8 | version(:icon) { process resize_to_fill: [128, 64] }
9 | version(:small) { process resize_to_fill: [256, 128] }
10 |
11 | def store_dir
12 | "uploads/#{model.class.to_s.underscore}/#{model.id}"
13 | end
14 |
15 | def default_url
16 | self.class.processors.each do |name, opts, *other|
17 | return "http://placehold.it/#{opts.join('x')}/#{(0..2).map{rand(255).to_i.to_s(16)}.join}" if %w(resize_to_fill resize_to_fit).include? name.to_s
18 | end
19 | nil
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/controllers/admin/planets_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Admin::PlanetsController do
4 | describe 'GET index' do
5 | subject(:do_request) { get :index }
6 |
7 | it_behaves_like 'an admin action'
8 | end
9 |
10 | describe 'GET show' do
11 | let(:planet) { create :planet }
12 | subject(:do_request) { get :show, id: planet }
13 |
14 | it_behaves_like 'an admin action'
15 | end
16 |
17 | describe 'GET new' do
18 | subject(:do_request) { get :new }
19 |
20 | it_behaves_like 'an admin action'
21 | end
22 |
23 | describe 'GET edit' do
24 | let(:planet) { create :planet }
25 | subject(:do_request) { get :edit, id: planet }
26 |
27 | it_behaves_like 'an admin action'
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/test/exoplanets/app/controllers/admin/users_controller.rb:
--------------------------------------------------------------------------------
1 | class Admin::UsersController < Admin::ApplicationController
2 | load_and_authorize_resource
3 |
4 | def create
5 | @user = User.new user_params
6 |
7 | if @user.save
8 | redirect_to edit_admin_user_path(@user), notice: 'User created'
9 | else
10 | render :new, status: 422
11 | end
12 | end
13 |
14 | def update
15 | @user.update_attributes user_params
16 | if @user.save
17 | redirect_to admin_users_path, notice: "User updated."
18 | else
19 | render :edit, status: 422, alert: "Unable to update user."
20 | end
21 | end
22 |
23 | def user_params
24 | params.require(:user)
25 | .permit(:first_name, :email, :password, :password_confirmation, :last_name, :avatar)
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/test/exoplanets/app/uploaders/avatar_uploader.rb:
--------------------------------------------------------------------------------
1 | # encoding: utf-8
2 |
3 | class AvatarUploader < CarrierWave::Uploader::Base
4 | include CarrierWave::RMagick
5 | include CarrierWave::Meta
6 |
7 | process store_meta: [{md5sum: true}]
8 | version(:thumb) { process resize_to_fill: [90, 90] }
9 | version(:small_thumb) { process resize_to_fill: [50, 50] }
10 |
11 | def store_dir
12 | "images/#{ model.class.to_s.underscore }/#{ model.id }"
13 | end
14 |
15 | def extension_white_list
16 | %w(jpg jpeg gif png)
17 | end
18 |
19 | def default_url
20 | self.class.processors.each do |name, opts, *other|
21 | return "http://placehold.it/#{opts.join('x')}/#{(0..2).map{rand(255).to_i.to_s(16)}.join}" if %w(resize_to_fill resize_to_fit).include? name.to_s
22 | end
23 | nil
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/kaminari/_paginator.html.haml:
--------------------------------------------------------------------------------
1 | -# The container tag
2 | -# available local variables
3 | -# current_page: a page object for the currently displayed page
4 | -# total_pages: total number of pages
5 | -# per_page: number of items to fetch per page
6 | -# remote: data-remote
7 | -# paginator: the paginator that renders the pagination tags inside
8 | = paginator.render do
9 | %nav.pagination
10 | .buttons
11 | = first_page_tag unless current_page.first?
12 | = prev_page_tag unless current_page.first?
13 | - each_page do |page|
14 | - if page.left_outer? || page.right_outer? || page.inside_window?
15 | = page_tag page
16 | - elsif !page.was_truncated?
17 | = gap_tag
18 | = next_page_tag unless current_page.last?
19 | = last_page_tag unless current_page.last?
20 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/lib/exo/gradient_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Exo::Gradient do
4 | context 'created with colors and positions' do
5 | let(:color_1) { Exo::Color.new hex: 0x000000 }
6 | let(:color_2) { Exo::Color.new hex: 0xffffff }
7 | let(:color_3) { Exo::Color.new hex_argb: 0x00000000 }
8 | let(:colors) { [ color_1, color_2, color_3 ] }
9 | let(:positions) { [0.0, 0.4, 1.0] }
10 |
11 | let(:gradient) { Exo::Gradient.new colors: colors, positions: positions }
12 |
13 | describe '#at' do
14 | context 'with 0.2' do
15 | subject { gradient.at 0.2 }
16 |
17 | it { should be_a_color 127, 127, 127, 255 }
18 | end
19 |
20 | context 'with 0.7' do
21 | subject { gradient.at 0.7 }
22 |
23 | it { should be_a_color 127, 127, 127, 127 }
24 | end
25 |
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/devise/registrations/new.html.haml:
--------------------------------------------------------------------------------
1 | - content_for :head do
2 | = javascript_include_tag "jquery.YAPSM.min", "jquery.pwdcalc"
3 |
4 | %h2 Sign up
5 | = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-vertical' }) do |f|
6 | %fieldset.inputs
7 | / = f.error_notification
8 | / = devise_error_messages!
9 |
10 | = f.input :email, :required => true
11 | .pure-g
12 | .pure-u-1-2= f.input :first_name
13 | .pure-u-1-2= f.input :last_name
14 |
15 | .password
16 | = f.input :password, :required => true, as: :pwdcalc_simple, placeholder: 'simple_form.placeholders.user.password'.t
17 | = f.input :password_confirmation
18 |
19 | = default_actions submit: 'actions.sign_up'.t, icon: 'icon-off', class: 'large', no_cancel: true
20 |
21 | = render "devise/shared/links"
22 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/styles/index.html.haml:
--------------------------------------------------------------------------------
1 | - content_for :head do
2 | = javascript_include_tag "jquery.YAPSM.min", "jquery.pwdcalc"
3 |
4 | - breadcrumb 'Styles'
5 |
6 | - content_for :before_content do
7 | = breadcrumbs
8 |
9 | - content_for :content_header do
10 | = render partial: 'pills'
11 |
12 | - content_for :messages do
13 | .notice Signed in successfully
14 | .error Can't do that
15 |
16 | %h2 Cards
17 | = render partial: 'cards'
18 |
19 | %hr
20 |
21 | %h2 Lists
22 | = render partial: 'lists'
23 |
24 | %hr
25 |
26 | %h2 Forms
27 |
28 | = render partial: 'user_form'
29 | .small= render partial: 'user_form'
30 |
31 | = render partial: 'forms'
32 | .small= render partial: 'forms', locals: {prefix: 'small_'}
33 |
34 | %hr
35 |
36 | %h2 Breadcrumb
37 | = render partial: 'breadcrumb'
38 |
39 | %hr
40 |
41 | %h2 Button
42 | = render partial: 'buttons'
43 |
44 | %hr
45 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/CopyShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Full-screen textured quad shader
5 | */
6 |
7 | THREE.CopyShader = {
8 |
9 | uniforms: {
10 |
11 | "tDiffuse": { type: "t", value: null },
12 | "opacity": { type: "f", value: 1.0 }
13 |
14 | },
15 |
16 | vertexShader: [
17 |
18 | "varying vec2 vUv;",
19 |
20 | "void main() {",
21 |
22 | "vUv = uv;",
23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
24 |
25 | "}"
26 |
27 | ].join("\n"),
28 |
29 | fragmentShader: [
30 |
31 | "uniform float opacity;",
32 |
33 | "uniform sampler2D tDiffuse;",
34 |
35 | "varying vec2 vUv;",
36 |
37 | "void main() {",
38 |
39 | "vec4 texel = texture2D( tDiffuse, vUv );",
40 | "gl_FragColor = opacity * texel;",
41 |
42 | "}"
43 |
44 | ].join("\n")
45 |
46 | };
47 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/devise/registrations/edit.html.haml:
--------------------------------------------------------------------------------
1 | %h2
2 | Edit #{resource_name.to_s.humanize}
3 | = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-vertical' }) do |f|
4 | = f.error_notification
5 | = devise_error_messages!
6 | = f.input :name, :autofocus => true
7 | = f.input :email, :required => true
8 | = f.input :password, :autocomplete => "off", :hint => "leave it blank if you don't want to change it", :required => false
9 | = f.input :password_confirmation, :required => false
10 | = f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true
11 | = f.button :submit, 'Update', :class => 'btn-primary'
12 | %h3 Cancel my account
13 | %p
14 | Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}.
15 | = link_to "Back", :back
16 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_pills.sass:
--------------------------------------------------------------------------------
1 | .pills
2 | margin: 0
3 | background: $pad-border-color
4 | position: relative
5 |
6 | +button-container
7 | +border-radius($pad-border-radius-x, $pad-border-radius-y)
8 | +box-shadow($pad-shadow)
9 | +inline-list
10 |
11 | li
12 | position: relative
13 | z-index: 1
14 |
15 | +button('& > *', 1px 2px 4px)
16 | display: block
17 | +box-shadow(none)
18 |
19 | &:hover
20 | +box-shadow(0px 2px 3px rgba(0,0,0,0.5))
21 |
22 | +colorized-button('&', ' > *')
23 | +button-group('&', ' > *')
24 |
25 | &:hover
26 | z-index: 3
27 |
28 | &:first-child > *
29 | +border-radius-left($pad-border-radius-x, $pad-border-radius-y)
30 |
31 | &:last-child > *
32 | +border-radius-right($pad-border-radius-x, $pad-border-radius-y)
33 |
34 | &:first-child:last-child > *
35 | +border-radius($pad-border-radius-x, $pad-border-radius-y)
36 |
37 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/LuminosityShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Luminosity
5 | * http://en.wikipedia.org/wiki/Luminosity
6 | */
7 |
8 | THREE.LuminosityShader = {
9 |
10 | uniforms: {
11 |
12 | "tDiffuse": { type: "t", value: null }
13 |
14 | },
15 |
16 | vertexShader: [
17 |
18 | "varying vec2 vUv;",
19 |
20 | "void main() {",
21 |
22 | "vUv = uv;",
23 |
24 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
25 |
26 | "}"
27 |
28 | ].join("\n"),
29 |
30 | fragmentShader: [
31 |
32 | "uniform sampler2D tDiffuse;",
33 |
34 | "varying vec2 vUv;",
35 |
36 | "void main() {",
37 |
38 | "vec4 texel = texture2D( tDiffuse, vUv );",
39 |
40 | "vec3 luma = vec3( 0.299, 0.587, 0.114 );",
41 |
42 | "float v = dot( texel.xyz, luma );",
43 |
44 | "gl_FragColor = vec4( v, v, v, texel.w );",
45 |
46 | "}"
47 |
48 | ].join("\n")
49 |
50 | };
51 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/planets/planet.js.coffee:
--------------------------------------------------------------------------------
1 |
2 | class ex.Planet
3 | constructor: (@id=0, @rotation = 0, @rotationSpeed=20) ->
4 | @orbitables = []
5 |
6 | build: ->
7 | @node = document.createElement 'div'
8 | @body = document.createElement 'div'
9 | @node.appendChild @body
10 | @node.className = 'planet'
11 | @body.className = 'body'
12 |
13 | @body.setAttribute 'style', "background: url(images/#{@id}.png);"
14 | @node
15 |
16 | animate: (t) ->
17 |
18 | @lastTime = t if not @lastTime? or t - @lastTime > 1000
19 | @body.style.backgroundPosition = "#{@rotation}px 0"
20 |
21 | dif = (t - @lastTime) / 1000
22 |
23 | @rotation += @rotationSpeed * dif
24 |
25 | @orbitables.forEach (orbitable) -> orbitable.animate(dif)
26 | @lastTime = t
27 |
28 | addOrbitable: (orbitable) ->
29 | @orbitables.push orbitable unless orbitable in @orbitables
30 | @node.appendChild orbitable.node
31 | @node.appendChild orbitable.shadowNode
32 |
33 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/ColorifyShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Colorify shader
5 | */
6 |
7 | THREE.ColorifyShader = {
8 |
9 | uniforms: {
10 |
11 | "tDiffuse": { type: "t", value: null },
12 | "color": { type: "c", value: new THREE.Color( 0xffffff ) }
13 |
14 | },
15 |
16 | vertexShader: [
17 |
18 | "varying vec2 vUv;",
19 |
20 | "void main() {",
21 |
22 | "vUv = uv;",
23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
24 |
25 | "}"
26 |
27 | ].join("\n"),
28 |
29 | fragmentShader: [
30 |
31 | "uniform vec3 color;",
32 | "uniform sampler2D tDiffuse;",
33 |
34 | "varying vec2 vUv;",
35 |
36 | "void main() {",
37 |
38 | "vec4 texel = texture2D( tDiffuse, vUv );",
39 |
40 | "vec3 luma = vec3( 0.299, 0.587, 0.114 );",
41 | "float v = dot( texel.xyz, luma );",
42 |
43 | "gl_FragColor = vec4( v * color, texel.w );",
44 |
45 | "}"
46 |
47 | ].join("\n")
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/styles/_input.html.haml:
--------------------------------------------------------------------------------
1 | - prefix ||= ''
2 | - id ||= "#{prefix}input_#{name.parameterize}#{rand(1000)}"
3 | - value ||= nil
4 | - type ||= 'text'
5 | - name ||= type.capitalize
6 | - placeholder ||= name.capitalize
7 | - has_error ||= false
8 | - hint ||= nil
9 | - attrs ||= {}
10 | - disabled = attrs[:disabled]
11 | - readonly = attrs[:readonly]
12 | - cls = attrs[:class]
13 |
14 | - options = {id: id ,type: type, placeholder: placeholder, value: value}.merge attrs
15 |
16 | .input{class: "#{type} #{name.parameterize} #{readonly ? 'readonly' : ''} #{disabled ? 'disabled' : ''} #{has_error ? 'field_with_errors' : ''} #{hint ? 'field_with_hint' : ''} #{cls}"}
17 | - if %w(checkbox radio).include? type
18 | %input{options}
19 | %label{for: id}= name
20 |
21 | - else
22 | %label{for: id}= name
23 | %input{options}
24 | - if type == :range
25 | %output{for: id, name: name}
26 |
27 | - if has_error
28 | %span.error Can't be blank
29 |
30 | - if hint
31 | %span.hint= hint
32 |
33 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/styles/_select.html.haml:
--------------------------------------------------------------------------------
1 | - prefix ||= ''
2 | - id ||= "#{prefix}input_#{name.parameterize}"
3 | - name ||= type.capitalize
4 | - placeholder ||= name.capitalize
5 | - has_error ||= false
6 | - type ||= 'select'
7 | - hint ||= nil
8 | - required ||= false
9 | - attrs ||= {}
10 | - disabled = attrs[:disabled]
11 | - readonly = attrs[:readonly]
12 | - cls = attrs[:class]
13 |
14 | - require 'faker'
15 |
16 | - options = {id: id , placeholder: placeholder}.merge attrs
17 |
18 | .input{class: "#{type} #{name.parameterize} #{readonly ? 'readonly' : ''} #{disabled ? 'disabled' : ''} #{has_error ? 'field_with_errors' : ''} #{hint ? 'field_with_hint' : ''} #{cls}"}
19 | %label{for: id, class: required ? 'required' : ''}
20 | - if required
21 | %i.icon-asterisk
22 | = name
23 | %select{options}
24 | - 10.times do |i|
25 | %option{value: i}= Faker::Lorem.words(3).join(' ').capitalize
26 |
27 | - if has_error
28 | %span.error Can't be blank
29 |
30 | - if hint
31 | %span.hint= hint
32 |
33 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_flashes.sass:
--------------------------------------------------------------------------------
1 | .notice
2 | background: transparentize($color-green-light, 0.6)
3 | border: 1px solid transparentize($color-green-light, 0.4)
4 |
5 | +before('\f058')
6 | font-family: $font-awesome
7 | color: $color-green-light
8 | margin-right: $fib-5
9 |
10 | .error, .alert
11 | background: transparentize($color-red-light, 0.6)
12 | border: 1px solid transparentize($color-red-light, 0.4)
13 |
14 | +before('\f06a')
15 | font-family: $font-awesome
16 | color: $color-red-light
17 | margin-right: $fib-5
18 |
19 | .notice, .error, .alert
20 | color: $color-grey-3
21 | padding: 5px 8px
22 | margin: 13px 0
23 | overflow: hidden
24 | display: block
25 |
26 | +text-shadow(0 0 3px transparentize($color-blue-dark, 0.5))
27 | +border-radius(4px, 6px)
28 | +transition(opacity 0.3s, height 0.3s linear 0.5s, padding 0.3s linear 0.5s, margin 0.3s linear 0.5s)
29 |
30 | &.hidden
31 | margin: 0
32 | height: 0 !important
33 | padding: 0
34 | +opacity(0)
35 |
36 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/ColorCorrectionShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Color correction
5 | */
6 |
7 | THREE.ColorCorrectionShader = {
8 |
9 | uniforms: {
10 |
11 | "tDiffuse": { type: "t", value: null },
12 | "powRGB": { type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
13 | "mulRGB": { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
14 |
15 | },
16 |
17 | vertexShader: [
18 |
19 | "varying vec2 vUv;",
20 |
21 | "void main() {",
22 |
23 | "vUv = uv;",
24 |
25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26 |
27 | "}"
28 |
29 | ].join("\n"),
30 |
31 | fragmentShader: [
32 |
33 | "uniform sampler2D tDiffuse;",
34 | "uniform vec3 powRGB;",
35 | "uniform vec3 mulRGB;",
36 |
37 | "varying vec2 vUv;",
38 |
39 | "void main() {",
40 |
41 | "gl_FragColor = texture2D( tDiffuse, vUv );",
42 | "gl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );",
43 |
44 | "}"
45 |
46 | ].join("\n")
47 |
48 | };
49 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/devise/shared/_links.html.haml:
--------------------------------------------------------------------------------
1 | - if controller_name != 'sessions'
2 | = link_to "Sign in", new_session_path(resource_name)
3 | %br/
4 | - if devise_mapping.registerable? && controller_name != 'registrations'
5 | = link_to "Sign up", new_registration_path(resource_name)
6 | %br/
7 | - if devise_mapping.recoverable? && controller_name != 'passwords'
8 | = link_to "Forgot your password?", new_password_path(resource_name)
9 | %br/
10 | - if devise_mapping.confirmable? && controller_name != 'confirmations'
11 | = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
12 | %br/
13 | - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
14 | = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
15 | %br/
16 | - if devise_mapping.omniauthable?
17 | - resource_class.omniauth_providers.each do |provider|
18 | = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
19 | %br/
20 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/styles/_user_form.haml:
--------------------------------------------------------------------------------
1 | = simple_form_for current_user, url: '/', method: :get do |f|
2 | %fieldset.inputs
3 | = f.input :email
4 | .pure-g
5 | .pure-u-1-2= f.input :first_name
6 | .pure-u-1-2= f.input :last_name
7 |
8 | .pure-g
9 | .pure-u-1-2= f.input :avatar
10 | .pure-u-1-2.small
11 | = render partial: 'input', locals: { type: :range, name: 'weight', value: 75, attrs: { 'min-value' => 0, 'max-value' => 100 } }
12 | = render partial: 'input', locals: { type: :range, name: 'weight', value: 75, attrs: { 'min-value' => 0, 'max-value' => 100 } }
13 |
14 | = f.input :created_at, wrapper_html: { class: 'small' }
15 | = f.input :updated_at, wrapper_html: { class: 'disabled small' }, input_html: { disabled: true }
16 |
17 | .password
18 | = f.input :password, :required => true, as: :pwdcalc_simple, placeholder: 'simple_form.placeholders.user.password'.t
19 | = f.input :password_confirmation
20 |
21 | = default_actions submit: 'actions.update'.t, icon: 'icon-ok', class: 'large'
22 |
--------------------------------------------------------------------------------
/test/exoplanets/README:
--------------------------------------------------------------------------------
1 | Exoplanets
2 | ========================
3 |
4 | This application was generated with the rails_apps_composer gem:
5 | https://github.com/RailsApps/rails_apps_composer
6 | provided by the RailsApps Project:
7 | http://railsapps.github.io/
8 |
9 | ________________________
10 |
11 | Recipes:
12 | ["apps4", "controllers", "core", "email", "extras", "frontend", "gems", "git", "init", "models", "prelaunch", "railsapps", "readme", "routes", "saas", "setup", "testing", "views"]
13 |
14 | Preferences:
15 | {:git=>true, :apps4=>"none", :dev_webserver=>"unicorn", :prod_webserver=>"unicorn", :database=>"postgresql", :templates=>"haml", :unit_test=>"rspec", :integration=>"rspec-capybara", :continuous_testing=>"guard", :fixtures=>"factory_girl", :frontend=>"normalize", :email=>"none", :authentication=>"devise", :devise_modules=>"default", :authorization=>"cancan", :form_builder=>"simple_form", :starter_app=>"admin_app", :rvmrc=>false, :quiet_assets=>true, :local_env_file=>true, :better_errors=>true, :ban_spiders=>true, :jsruntime=>false}
16 |
17 | ________________________
18 |
19 | License
20 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/forms.js.coffee:
--------------------------------------------------------------------------------
1 |
2 | window.initForms = ->
3 | $('.notice, .error').each -> $(@).height $(@).height()
4 | $('.notice, .error').click -> $(@).addClass 'hidden'
5 |
6 | $('.input input, .input textarea, .input select').focus -> $(@).parents('.input').addClass 'focus'
7 | $('.input input, .input textarea, .input select').blur -> $(@).parents('.input').removeClass 'focus'
8 |
9 | $('.input select').each -> $(@).wrap ''
10 | $('output[for]').each ->
11 | output = $(@)
12 | input = $("##{output.attr('for')}")
13 | input.on 'input', -> output.val input.val()
14 | output.val input.val()
15 |
16 | $('select:not(.date):not(.time):not(.datetime)').chosen(width: '100%')
17 |
18 | $('select[multiple]').parents('.select').addClass('multiple')
19 | # $('#input_long_multi_chosen').addClass('chosen-with-drop')
20 |
21 | $('input[type=file]').change (e) ->
22 | input = $(@)
23 | value = input.val()
24 | container = input.parents('.input')
25 | container.find('.label').removeClass('placeholder').text(value)
26 |
27 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Mark Hahn
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/common/mixins/_responsive.sass:
--------------------------------------------------------------------------------
1 |
2 | =for-small-phone()
3 | @media (max-width: $breakpoint-phone)
4 | @content
5 |
6 | =for-phone()
7 | @media (max-width: $breakpoint-tablet-1)
8 | @content
9 |
10 | =for-tablet()
11 | @media (min-width: $breakpoint-tablet) and (max-width: $breakpoint-desktop-1)
12 | @content
13 |
14 | =for-small-desktop()
15 | @media (min-width: $breakpoint-desktop) and (max-width: $breakpoint-large-1)
16 | @content
17 |
18 | =for-large-desktop()
19 | @media (min-width: $breakpoint-large)
20 | @content
21 |
22 | =for-desktop()
23 | @media (min-width: $breakpoint-desktop)
24 | @content
25 |
26 | =upto-tablet()
27 | @media (max-width: $breakpoint-desktop-1)
28 | @content
29 |
30 | =upto-small-desktop()
31 | @media (max-width: $breakpoint-large-1)
32 | @content
33 |
34 | =downfrom-tablet()
35 | @media (min-width: $breakpoint-tablet)
36 | @content
37 |
38 | =webkit-only()
39 | @media screen and (-webkit-min-device-pixel-ratio:0)
40 | @content
41 |
42 | =gecko-only()
43 | @-moz-document url-prefix()
44 | @content
45 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/TexturePass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.TexturePass = function ( texture, opacity ) {
6 |
7 | if ( THREE.CopyShader === undefined )
8 | console.error( "THREE.TexturePass relies on THREE.CopyShader" );
9 |
10 | var shader = THREE.CopyShader;
11 |
12 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
13 |
14 | this.uniforms[ "opacity" ].value = ( opacity !== undefined ) ? opacity : 1.0;
15 | this.uniforms[ "tDiffuse" ].value = texture;
16 |
17 | this.material = new THREE.ShaderMaterial( {
18 |
19 | uniforms: this.uniforms,
20 | vertexShader: shader.vertexShader,
21 | fragmentShader: shader.fragmentShader
22 |
23 | } );
24 |
25 | this.enabled = true;
26 | this.needsSwap = false;
27 |
28 | };
29 |
30 | THREE.TexturePass.prototype = {
31 |
32 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
33 |
34 | THREE.EffectComposer.quad.material = this.material;
35 |
36 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, readBuffer );
37 |
38 | }
39 |
40 | };
41 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/BlendShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Blend two textures
5 | */
6 |
7 | THREE.BlendShader = {
8 |
9 | uniforms: {
10 |
11 | "tDiffuse1": { type: "t", value: null },
12 | "tDiffuse2": { type: "t", value: null },
13 | "mixRatio": { type: "f", value: 0.5 },
14 | "opacity": { type: "f", value: 1.0 }
15 |
16 | },
17 |
18 | vertexShader: [
19 |
20 | "varying vec2 vUv;",
21 |
22 | "void main() {",
23 |
24 | "vUv = uv;",
25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26 |
27 | "}"
28 |
29 | ].join("\n"),
30 |
31 | fragmentShader: [
32 |
33 | "uniform float opacity;",
34 | "uniform float mixRatio;",
35 |
36 | "uniform sampler2D tDiffuse1;",
37 | "uniform sampler2D tDiffuse2;",
38 |
39 | "varying vec2 vUv;",
40 |
41 | "void main() {",
42 |
43 | "vec4 texel1 = texture2D( tDiffuse1, vUv );",
44 | "vec4 texel2 = texture2D( tDiffuse2, vUv );",
45 | "gl_FragColor = opacity * mix( texel1, texel2, mixRatio );",
46 |
47 | "}"
48 |
49 | ].join("\n")
50 |
51 | };
52 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/planets/cloud.js.coffee:
--------------------------------------------------------------------------------
1 | class ex.Cloud extends ex.Orbitable
2 | getStyle: (front, x, y, rotate, dist) ->
3 | scale = Math.abs Math.cos(ex.deg2rad dist / 128 * 90)
4 | shadow = (5+@altitude) * 1 / scale
5 | ratio = (1-scale)
6 | r3 = ratio * ratio * ratio
7 | r = 255 - Math.round r3 * (255 - 0x8f)
8 | g = 255 - Math.round r3 * (255 - 0xed)
9 | b = 255 - Math.round r3 * (255 - 0xf4)
10 |
11 | transform = @getTransform rotate, Math.max scale, 0.3
12 |
13 | "#{transform} background: rgb(#{r},#{g},#{b}); box-shadow: 0 0 4px 1px rgb(#{r},#{g},#{b}), 0 0 8px 1px rgb(#{r},#{g},#{b});"
14 |
15 | getShadowStyle: (front, x, y, rotate, dist) ->
16 | scale = Math.abs Math.cos(ex.deg2rad dist / 128 * 90)
17 |
18 | transform = @getTransform rotate, Math.max scale, 0.0001
19 |
20 | if front
21 | transform
22 | else
23 | 'display: none;'
24 |
25 | getTransform: (rotate, scale) ->
26 | transformString = "rotate(#{Math.round ex.rad2deg rotate}deg) scale(#{scale}, 1)"
27 | prefixes = ['', '-o-', '-ms-', '-moz-', '-webkit-']
28 | prefixes.map((p) -> "#{p}transform: #{transformString};").join('')
29 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/admin/shared/_session.html.haml:
--------------------------------------------------------------------------------
1 | %nav#session.vcard
2 |
3 | - if user_signed_in?
4 | .avatar
5 | %figure
6 | - if current_user.avatar.present?
7 | = image_tag current_user.avatar.thumb
8 |
9 | - if current_user.name.present?
10 | .fn= current_user.name
11 |
12 | = link_to current_user.email, admin_user_path(current_user), class: 'email'
13 |
14 | - unless current_user.roles.empty?
15 | .roles
16 | - if current_user.has_role :admin
17 | .badge.admin admin
18 | - if current_user.has_role :superuser
19 | .badge.superuser superuser
20 |
21 | = link_to destroy_user_session_path, class: 'button very-small red', method: :delete do
22 | .icon-off
23 | = t('actions.sign_out')
24 |
25 | - else
26 | .avatar
27 | %figure
28 |
29 | .fn= 'session.anonymous'.t
30 | .message= 'session.message'.t
31 |
32 | = link_to new_user_session_path, class: 'button small blue' do
33 | .icon-signin
34 | = 'actions.sign_in'.t
35 |
36 | = link_to new_user_registration_path, class: 'button small green' do
37 | .icon-off
38 | = 'actions.sign_up'.t
39 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_cards.sass:
--------------------------------------------------------------------------------
1 | =card
2 | overflow: hidden
3 | white-space: nowrap
4 |
5 | +relative
6 | +border-radius(4px)
7 | +box-shadow($card-shadow)
8 |
9 | .front, .back
10 | padding: $fib-6
11 | display: inline-block
12 | width: 100%
13 | color: $card-dark-text-color
14 |
15 | +transition(all 0.3s)
16 |
17 | .front
18 | border-bottom: 2px solid $card-border-color
19 | background: $card-color
20 | +transform(translate3d(0, 0, 0))
21 |
22 | .back
23 | border-bottom: 2px solid $card-dark-border-color
24 | background: $card-dark-color
25 | color: $card-light-text-color
26 | bottom: 0
27 |
28 | +absolute
29 | +transform(translate3d(100%, 0, 0))
30 |
31 | .icon-refresh
32 | right: $fib-4
33 | cursor: pointer
34 |
35 | +absolute($fib-4, initial)
36 | +opacity(0)
37 | +transition(all, 0.3s)
38 |
39 | &:hover
40 | .icon-refresh
41 | +opacity(1)
42 |
43 | &.flipped
44 | .front
45 | +transform(translate3d(-100%, 0, 0))
46 |
47 | .back
48 | +transform(translate3d(0, 0, 0))
49 |
50 | .icon-refresh
51 | color: $card-light-text-color
52 |
53 | .card
54 | +card
55 |
--------------------------------------------------------------------------------
/test/exoplanets/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Exoplanets::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 | end
30 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/ShaderPass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.ShaderPass = function ( shader, textureID ) {
6 |
7 | this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse";
8 |
9 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
10 |
11 | this.material = new THREE.ShaderMaterial( {
12 |
13 | uniforms: this.uniforms,
14 | vertexShader: shader.vertexShader,
15 | fragmentShader: shader.fragmentShader
16 |
17 | } );
18 |
19 | this.renderToScreen = false;
20 |
21 | this.enabled = true;
22 | this.needsSwap = true;
23 | this.clear = false;
24 |
25 | };
26 |
27 | THREE.ShaderPass.prototype = {
28 |
29 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
30 |
31 | if ( this.uniforms[ this.textureID ] ) {
32 |
33 | this.uniforms[ this.textureID ].value = readBuffer;
34 |
35 | }
36 |
37 | THREE.EffectComposer.quad.material = this.material;
38 |
39 | if ( this.renderToScreen ) {
40 |
41 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera );
42 |
43 | } else {
44 |
45 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, writeBuffer, this.clear );
46 |
47 | }
48 |
49 | }
50 |
51 | };
52 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/planets/boot.js.coffee:
--------------------------------------------------------------------------------
1 | #= require ./utils
2 | #= require ./random
3 | #= require ./orbitable
4 | #= require ./cloud
5 | #= require ./planet
6 |
7 | createCluster = (planet, lat, lng, count) ->
8 | speed = 50+Math.random()*5
9 | for i in [0..count]
10 | cloud = new ex.Cloud lat + Math.random()*30, lng+Math.random()*30, 0, speed, 3 + Math.random() * 10
11 | cloud.build()
12 |
13 | planet.addOrbitable cloud
14 |
15 | createPlanet = (id=0) ->
16 | planet = new ex.Planet id
17 |
18 | body = document.getElementById('stage')
19 |
20 | body.appendChild planet.build()
21 |
22 | for i in [0..10]
23 | createCluster planet, 180-Math.random()*360, 180-Math.random()*360, 1+Math.random() * 10
24 |
25 | body.onclick = ->
26 | console.log('click')
27 | window.playing = not window.playing
28 | window.animate() if window.playing
29 |
30 | planet
31 |
32 | window.playing = false
33 |
34 | window.onload = ->
35 | # planets = (createPlanet(Math.round(Math.random()* 4)) for i in [0..3])
36 | planets = [createPlanet 0]
37 |
38 | window.animate = ->
39 | planets.forEach (planet) ->
40 | planet.animate(new Date().getTime())
41 |
42 | setTimeout (-> requestAnimationFrame animate if playing), 0
43 |
44 | animate()
45 |
46 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/SepiaShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Sepia tone shader
5 | * based on glfx.js sepia shader
6 | * https://github.com/evanw/glfx.js
7 | */
8 |
9 | THREE.SepiaShader = {
10 |
11 | uniforms: {
12 |
13 | "tDiffuse": { type: "t", value: null },
14 | "amount": { type: "f", value: 1.0 }
15 |
16 | },
17 |
18 | vertexShader: [
19 |
20 | "varying vec2 vUv;",
21 |
22 | "void main() {",
23 |
24 | "vUv = uv;",
25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26 |
27 | "}"
28 |
29 | ].join("\n"),
30 |
31 | fragmentShader: [
32 |
33 | "uniform float amount;",
34 |
35 | "uniform sampler2D tDiffuse;",
36 |
37 | "varying vec2 vUv;",
38 |
39 | "void main() {",
40 |
41 | "vec4 color = texture2D( tDiffuse, vUv );",
42 | "vec3 c = color.rgb;",
43 |
44 | "color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
45 | "color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
46 | "color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
47 |
48 | "gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
49 |
50 | "}"
51 |
52 | ].join("\n")
53 |
54 | };
55 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/UnpackDepthRGBAShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Unpack RGBA depth shader
5 | * - show RGBA encoded depth as monochrome color
6 | */
7 |
8 | THREE.UnpackDepthRGBAShader = {
9 |
10 | uniforms: {
11 |
12 | "tDiffuse": { type: "t", value: null },
13 | "opacity": { type: "f", value: 1.0 }
14 |
15 | },
16 |
17 | vertexShader: [
18 |
19 | "varying vec2 vUv;",
20 |
21 | "void main() {",
22 |
23 | "vUv = uv;",
24 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
25 |
26 | "}"
27 |
28 | ].join("\n"),
29 |
30 | fragmentShader: [
31 |
32 | "uniform float opacity;",
33 |
34 | "uniform sampler2D tDiffuse;",
35 |
36 | "varying vec2 vUv;",
37 |
38 | // RGBA depth
39 |
40 | "float unpackDepth( const in vec4 rgba_depth ) {",
41 |
42 | "const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
43 | "float depth = dot( rgba_depth, bit_shift );",
44 | "return depth;",
45 |
46 | "}",
47 |
48 | "void main() {",
49 |
50 | "float depth = 1.0 - unpackDepth( texture2D( tDiffuse, vUv ) );",
51 | "gl_FragColor = opacity * vec4( vec3( depth ), 1.0 );",
52 |
53 | "}"
54 |
55 | ].join("\n")
56 |
57 | };
58 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/MirrorShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author felixturner / http://airtight.cc/
3 | *
4 | * Mirror Shader
5 | * Copies half the input to the other half
6 | *
7 | * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom)
8 | */
9 |
10 | THREE.MirrorShader = {
11 |
12 | uniforms: {
13 |
14 | "tDiffuse": { type: "t", value: null },
15 | "side": { type: "i", value: 1 }
16 |
17 | },
18 |
19 | vertexShader: [
20 |
21 | "varying vec2 vUv;",
22 |
23 | "void main() {",
24 |
25 | "vUv = uv;",
26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
27 |
28 | "}"
29 |
30 | ].join("\n"),
31 |
32 | fragmentShader: [
33 |
34 | "uniform sampler2D tDiffuse;",
35 | "uniform int side;",
36 |
37 | "varying vec2 vUv;",
38 |
39 | "void main() {",
40 |
41 | "vec2 p = vUv;",
42 | "if (side == 0){",
43 | "if (p.x > 0.5) p.x = 1.0 - p.x;",
44 | "}else if (side == 1){",
45 | "if (p.x < 0.5) p.x = 1.0 - p.x;",
46 | "}else if (side == 2){",
47 | "if (p.y < 0.5) p.y = 1.0 - p.y;",
48 | "}else if (side == 3){",
49 | "if (p.y > 0.5) p.y = 1.0 - p.y;",
50 | "} ",
51 | "vec4 color = texture2D(tDiffuse, p);",
52 | "gl_FragColor = color;",
53 |
54 | "}"
55 |
56 | ].join("\n")
57 |
58 | };
59 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/RenderPass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
6 |
7 | this.scene = scene;
8 | this.camera = camera;
9 |
10 | this.overrideMaterial = overrideMaterial;
11 |
12 | this.clearColor = clearColor;
13 | this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
14 |
15 | this.oldClearColor = new THREE.Color();
16 | this.oldClearAlpha = 1;
17 |
18 | this.enabled = true;
19 | this.clear = true;
20 | this.needsSwap = false;
21 |
22 | };
23 |
24 | THREE.RenderPass.prototype = {
25 |
26 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
27 |
28 | this.scene.overrideMaterial = this.overrideMaterial;
29 |
30 | if ( this.clearColor ) {
31 |
32 | this.oldClearColor.copy( renderer.getClearColor() );
33 | this.oldClearAlpha = renderer.getClearAlpha();
34 |
35 | renderer.setClearColor( this.clearColor, this.clearAlpha );
36 |
37 | }
38 |
39 | renderer.render( this.scene, this.camera, readBuffer, this.clear );
40 |
41 | if ( this.clearColor ) {
42 |
43 | renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
44 |
45 | }
46 |
47 | this.scene.overrideMaterial = null;
48 |
49 | }
50 |
51 | };
52 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/DOFMipMapShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Depth-of-field shader using mipmaps
5 | * - from Matt Handley @applmak
6 | * - requires power-of-2 sized render target with enabled mipmaps
7 | */
8 |
9 | THREE.DOFMipMapShader = {
10 |
11 | uniforms: {
12 |
13 | "tColor": { type: "t", value: null },
14 | "tDepth": { type: "t", value: null },
15 | "focus": { type: "f", value: 1.0 },
16 | "maxblur": { type: "f", value: 1.0 }
17 |
18 | },
19 |
20 | vertexShader: [
21 |
22 | "varying vec2 vUv;",
23 |
24 | "void main() {",
25 |
26 | "vUv = uv;",
27 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
28 |
29 | "}"
30 |
31 | ].join("\n"),
32 |
33 | fragmentShader: [
34 |
35 | "uniform float focus;",
36 | "uniform float maxblur;",
37 |
38 | "uniform sampler2D tColor;",
39 | "uniform sampler2D tDepth;",
40 |
41 | "varying vec2 vUv;",
42 |
43 | "void main() {",
44 |
45 | "vec4 depth = texture2D( tDepth, vUv );",
46 |
47 | "float factor = depth.x - focus;",
48 |
49 | "vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
50 |
51 | "gl_FragColor = col;",
52 | "gl_FragColor.a = 1.0;",
53 |
54 | "}"
55 |
56 | ].join("\n")
57 |
58 | };
59 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/support/matchers/controllers.rb:
--------------------------------------------------------------------------------
1 | RSpec::Matchers.define :respond_by do |expected|
2 | label = nil
3 | status = nil
4 | if expected.is_a? Symbol
5 | status = Exo::Statuses.find_status(expected)
6 | label = expected
7 | else
8 | status = expected
9 | label = Exo::Statuses.find_label(expected)
10 | end
11 |
12 | match do |actual|
13 | is_valid_response?(actual) &&
14 | actual.response_code == status
15 | end
16 |
17 | failure_message_for_should do |actual|
18 | if is_valid_response? actual
19 |
20 | "expected that #{Exo::Statuses.find_label actual.response_code} (#{actual.response_code}) would respond by #{label} (#{status}})"
21 | else
22 | "expected that #{actual} would respond by #{label} (#{status})"
23 | end
24 | end
25 |
26 | failure_message_for_should_not do |actual|
27 | if is_valid_response? actual
28 | "expected that #{Exo::Statuses.find_label actual.response_code} (#{actual.response_code}) would not respond by #{label} (#{status}})"
29 | else
30 | "expected that #{actual} would not respond by #{label} (#{status})"
31 | end
32 | end
33 |
34 | description do
35 | "respond by #{label} (#{status})"
36 | end
37 |
38 | def is_valid_response? actual
39 | actual.present? &&
40 | actual.respond_to?(:response_code)
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/NormalMapShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Normal map shader
5 | * - compute normals from heightmap
6 | */
7 |
8 | THREE.NormalMapShader = {
9 |
10 | uniforms: {
11 |
12 | "heightMap": { type: "t", value: null },
13 | "resolution": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
14 | "scale": { type: "v2", value: new THREE.Vector2( 1, 1 ) },
15 | "height": { type: "f", value: 0.05 }
16 |
17 | },
18 |
19 | vertexShader: [
20 |
21 | "varying vec2 vUv;",
22 |
23 | "void main() {",
24 |
25 | "vUv = uv;",
26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
27 |
28 | "}"
29 |
30 | ].join("\n"),
31 |
32 | fragmentShader: [
33 |
34 | "uniform float height;",
35 | "uniform vec2 resolution;",
36 | "uniform sampler2D heightMap;",
37 |
38 | "varying vec2 vUv;",
39 |
40 | "void main() {",
41 |
42 | "float val = texture2D( heightMap, vUv ).x;",
43 |
44 | "float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
45 | "float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
46 |
47 | "gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );",
48 |
49 | "}"
50 |
51 | ].join("\n")
52 |
53 | };
54 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/inputs/_files.sass:
--------------------------------------------------------------------------------
1 | +for-types(file)
2 | input
3 | z-index: 3
4 |
5 | +opacity(0)
6 |
7 | .preview
8 | position: static
9 |
10 | img
11 | right: 0
12 | height: 100%
13 | width: auto
14 |
15 | +absolute(0,inherit)
16 |
17 | .label
18 | color: $color-grey-5
19 | background: transparent
20 | border: 0
21 | padding: $fib-7 + 4px $fib-7 0 $fib-7
22 | outline: none
23 | width: 100%
24 |
25 | +absolute
26 | +transition(color 0.3s)
27 | +text-shadow(0 1px 3px rgba(0,0,0,0.7))
28 | +font-block(2, 3)
29 |
30 | &.placeholder
31 | font-style: italic
32 | color: $color-grey-7
33 |
34 | .meta
35 | text-align: left
36 | color: $color-grey-6
37 |
38 | +absolute($fib-4, $fib-11)
39 |
40 | & > *
41 | display: inline
42 |
43 | &:last-child:before
44 | content: ', '
45 |
46 | .number
47 | color: $color-blue-light
48 |
49 | .small &, &.small
50 | .label
51 | height: 32px
52 | padding: $fib-4 $fib-4 $fib-3 $fib-11
53 |
54 | +font-block(1, 1.2)
55 |
56 | .meta
57 | right: 32px + $fib-6
58 | +absolute(5px, inherit)
59 |
60 | div
61 | display: inline-block
62 |
63 | & + div
64 | +before(', ')
65 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/RGBShiftShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author felixturner / http://airtight.cc/
3 | *
4 | * RGB Shift Shader
5 | * Shifts red and blue channels from center in opposite directions
6 | * Ported from http://kriss.cx/tom/2009/05/rgb-shift/
7 | * by Tom Butterworth / http://kriss.cx/tom/
8 | *
9 | * amount: shift distance (1 is width of input)
10 | * angle: shift angle in radians
11 | */
12 |
13 | THREE.RGBShiftShader = {
14 |
15 | uniforms: {
16 |
17 | "tDiffuse": { type: "t", value: null },
18 | "amount": { type: "f", value: 0.005 },
19 | "angle": { type: "f", value: 0.0 }
20 |
21 | },
22 |
23 | vertexShader: [
24 |
25 | "varying vec2 vUv;",
26 |
27 | "void main() {",
28 |
29 | "vUv = uv;",
30 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
31 |
32 | "}"
33 |
34 | ].join("\n"),
35 |
36 | fragmentShader: [
37 |
38 | "uniform sampler2D tDiffuse;",
39 | "uniform float amount;",
40 | "uniform float angle;",
41 |
42 | "varying vec2 vUv;",
43 |
44 | "void main() {",
45 |
46 | "vec2 offset = amount * vec2( cos(angle), sin(angle));",
47 | "vec4 cr = texture2D(tDiffuse, vUv + offset);",
48 | "vec4 cga = texture2D(tDiffuse, vUv);",
49 | "vec4 cb = texture2D(tDiffuse, vUv - offset);",
50 | "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
51 |
52 | "}"
53 |
54 | ].join("\n")
55 |
56 | };
57 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/KaleidoShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author felixturner / http://airtight.cc/
3 | *
4 | * Kaleidoscope Shader
5 | * Radial reflection around center point
6 | * Ported from: http://pixelshaders.com/editor/
7 | * by Toby Schachman / http://tobyschachman.com/
8 | *
9 | * sides: number of reflections
10 | * angle: initial angle in radians
11 | */
12 |
13 | THREE.KaleidoShader = {
14 |
15 | uniforms: {
16 |
17 | "tDiffuse": { type: "t", value: null },
18 | "sides": { type: "f", value: 6.0 },
19 | "angle": { type: "f", value: 0.0 }
20 |
21 | },
22 |
23 | vertexShader: [
24 |
25 | "varying vec2 vUv;",
26 |
27 | "void main() {",
28 |
29 | "vUv = uv;",
30 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
31 |
32 | "}"
33 |
34 | ].join("\n"),
35 |
36 | fragmentShader: [
37 |
38 | "uniform sampler2D tDiffuse;",
39 | "uniform float sides;",
40 | "uniform float angle;",
41 |
42 | "varying vec2 vUv;",
43 |
44 | "void main() {",
45 |
46 | "vec2 p = vUv - 0.5;",
47 | "float r = length(p);",
48 | "float a = atan(p.y, p.x) + angle;",
49 | "float tau = 2. * 3.1416 ;",
50 | "a = mod(a, tau/sides);",
51 | "a = abs(a - tau/sides/2.) ;",
52 | "p = r * vec2(cos(a), sin(a));",
53 | "vec4 color = texture2D(tDiffuse, p + 0.5);",
54 | "gl_FragColor = color;",
55 |
56 | "}"
57 |
58 | ].join("\n")
59 |
60 | };
61 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/BrightnessContrastShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author tapio / http://tapio.github.com/
3 | *
4 | * Brightness and contrast adjustment
5 | * https://github.com/evanw/glfx.js
6 | * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
7 | * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
8 | */
9 |
10 | THREE.BrightnessContrastShader = {
11 |
12 | uniforms: {
13 |
14 | "tDiffuse": { type: "t", value: null },
15 | "brightness": { type: "f", value: 0 },
16 | "contrast": { type: "f", value: 0 }
17 |
18 | },
19 |
20 | vertexShader: [
21 |
22 | "varying vec2 vUv;",
23 |
24 | "void main() {",
25 |
26 | "vUv = uv;",
27 |
28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
29 |
30 | "}"
31 |
32 | ].join("\n"),
33 |
34 | fragmentShader: [
35 |
36 | "uniform sampler2D tDiffuse;",
37 | "uniform float brightness;",
38 | "uniform float contrast;",
39 |
40 | "varying vec2 vUv;",
41 |
42 | "void main() {",
43 |
44 | "gl_FragColor = texture2D( tDiffuse, vUv );",
45 |
46 | "gl_FragColor.rgb += brightness;",
47 |
48 | "if (contrast > 0.0) {",
49 | "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;",
50 | "} else {",
51 | "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;",
52 | "}",
53 |
54 | "}"
55 |
56 | ].join("\n")
57 |
58 | };
59 |
--------------------------------------------------------------------------------
/test/exoplanets/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
We're sorry, but something went wrong.
54 |
55 | If you are the application owner check the logs for more information.
56 |
57 |
58 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/layouts/application.html.haml:
--------------------------------------------------------------------------------
1 | !!!5
2 | = cc_html class: 'no-js' do
3 | %head
4 | %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}
5 |
6 | %title= content_for?(:title) ? yield(:title) : "Exoplanets"
7 |
8 | %meta{content: content_for?(:description) ? yield(:description) : "Exoplanets", name: "description"}
9 |
10 | = render partial: 'shared/head'
11 |
12 | = stylesheet_link_tag "application", media: "all"
13 | = javascript_include_tag "application"
14 |
15 | = yield :head
16 |
17 | %body{class: "#{controller_name} #{action_name}"}
18 | = render partial: 'shared/navigation'
19 |
20 | .gutter
21 | #before-header.pure-g
22 | #before-header-left.pure-u-1-2= yield :before_header_left
23 | #before-header-right.pure-u-1-2= yield :before_header_right
24 |
25 | %header#header.pure-g
26 | #header-left.pure-u-1-2
27 | %h1 exoplanets
28 | = yield :header_left
29 | #header-right.pure-u-1-2
30 | = render partial: 'admin/shared/session'
31 | = yield :header_right
32 |
33 | #before-content
34 | = render 'layouts/messages'
35 | = yield :messages
36 |
37 | = yield :before_content
38 |
39 | #content
40 | %header#content-header= yield :content_header
41 | = yield
42 | %footer#content-footer= yield :content_footer
43 |
44 | #after-content
45 | = yield :after_content
46 |
47 | %footer#footer
48 |
--------------------------------------------------------------------------------
/test/exoplanets/app/views/layouts/admin.html.haml:
--------------------------------------------------------------------------------
1 | !!!5
2 | = cc_html class: 'no-js' do
3 | %head
4 | %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}
5 |
6 | %title= content_for?(:title) ? yield(:title) : "Exoplanets - Admin"
7 |
8 | %meta{content: content_for?(:description) ? yield(:description) : "Exoplanets", name: "description"}
9 |
10 | = render partial: 'shared/head'
11 |
12 | = stylesheet_link_tag "admin/application", media: "all"
13 | = javascript_include_tag "admin/application"
14 |
15 | = yield :head
16 |
17 | %body{class: "admin-#{controller_name} #{action_name}"}
18 | = render partial: 'admin/shared/navigation'
19 |
20 | .gutter
21 | #before-header.pure-g
22 | #before-header-left.pure-u-1-2= yield :before_header_left
23 | #before-header-right.pure-u-1-2= yield :before_header_right
24 |
25 | %header#header.pure-g
26 | #header-left.pure-u-1-2
27 | %h1 exoAdmin
28 | = yield :header_left
29 | #header-right.pure-u-1-2
30 | = render partial: 'admin/shared/session'
31 | = yield :header_right
32 |
33 | #before-content
34 | = render 'layouts/messages'
35 | = yield :messages
36 |
37 | = yield :before_content
38 |
39 | #content
40 | %header#content-header= yield :content_header
41 | = yield
42 | %footer#content-footer= yield :content_footer
43 |
44 | #after-content
45 | = yield :after_content
46 |
47 | %footer#footer
48 |
49 |
50 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/SavePass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.SavePass = function ( renderTarget ) {
6 |
7 | if ( THREE.CopyShader === undefined )
8 | console.error( "THREE.SavePass relies on THREE.CopyShader" );
9 |
10 | var shader = THREE.CopyShader;
11 |
12 | this.textureID = "tDiffuse";
13 |
14 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
15 |
16 | this.material = new THREE.ShaderMaterial( {
17 |
18 | uniforms: this.uniforms,
19 | vertexShader: shader.vertexShader,
20 | fragmentShader: shader.fragmentShader
21 |
22 | } );
23 |
24 | this.renderTarget = renderTarget;
25 |
26 | if ( this.renderTarget === undefined ) {
27 |
28 | this.renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
29 | this.renderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, this.renderTargetParameters );
30 |
31 | }
32 |
33 | this.enabled = true;
34 | this.needsSwap = false;
35 | this.clear = false;
36 |
37 | };
38 |
39 | THREE.SavePass.prototype = {
40 |
41 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
42 |
43 | if ( this.uniforms[ this.textureID ] ) {
44 |
45 | this.uniforms[ this.textureID ].value = readBuffer;
46 |
47 | }
48 |
49 | THREE.EffectComposer.quad.material = this.material;
50 |
51 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, this.renderTarget, this.clear );
52 |
53 | }
54 |
55 | };
56 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/DotScreenPass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.DotScreenPass = function ( center, angle, scale ) {
6 |
7 | if ( THREE.DotScreenShader === undefined )
8 | console.error( "THREE.DotScreenPass relies on THREE.DotScreenShader" );
9 |
10 | var shader = THREE.DotScreenShader;
11 |
12 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
13 |
14 | if ( center !== undefined ) this.uniforms[ "center" ].value.copy( center );
15 | if ( angle !== undefined ) this.uniforms[ "angle"].value = angle;
16 | if ( scale !== undefined ) this.uniforms[ "scale"].value = scale;
17 |
18 | this.material = new THREE.ShaderMaterial( {
19 |
20 | uniforms: this.uniforms,
21 | vertexShader: shader.vertexShader,
22 | fragmentShader: shader.fragmentShader
23 |
24 | } );
25 |
26 | this.enabled = true;
27 | this.renderToScreen = false;
28 | this.needsSwap = true;
29 |
30 | };
31 |
32 | THREE.DotScreenPass.prototype = {
33 |
34 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
35 |
36 | this.uniforms[ "tDiffuse" ].value = readBuffer;
37 | this.uniforms[ "tSize" ].value.set( readBuffer.width, readBuffer.height );
38 |
39 | THREE.EffectComposer.quad.material = this.material;
40 |
41 | if ( this.renderToScreen ) {
42 |
43 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera );
44 |
45 | } else {
46 |
47 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, writeBuffer, false );
48 |
49 | }
50 |
51 | }
52 |
53 | };
54 |
--------------------------------------------------------------------------------
/test/exoplanets/lib/exo/statuses.rb:
--------------------------------------------------------------------------------
1 | module Exo
2 | module Statuses
3 | LABEL_STATUS = {
4 | # 200 Responses
5 | success: 200,
6 | created: 201,
7 | accepted: 202,
8 | non_authoritative: 203,
9 | no_content: 204,
10 | reset_content: 205,
11 | partial_content: 206,
12 | multi_status: 207,
13 | already_reported: 208,
14 | im_used: 226,
15 |
16 | # 300 Redirections
17 | multiple_choices: 300,
18 | moved_permanently: 301,
19 | found: 302,
20 | redirect: 302, # alias of found
21 | see_other: 303,
22 | not_modified: 304,
23 | use_proxy: 305,
24 | switch_proxy: 306,
25 | temporary_redirect: 307,
26 | permanent_redirect: 308,
27 |
28 | # 400 Client Errors
29 | bad_request: 400,
30 | unauthorized: 401,
31 | payment_required: 402,
32 | forbidden: 403,
33 | not_found: 404,
34 | not_allowed: 405,
35 | not_acceptable: 406,
36 | authentication_required: 407,
37 | request_timeout: 408,
38 | conflict: 409,
39 | gone: 410,
40 |
41 | # 500 Server Errors
42 | internal_server_error: 500,
43 | not_implemented: 501,
44 | bad_gateway: 502,
45 | service_unavailable: 503,
46 | gateway_timeout: 504,
47 | http_version_not_supported: 505,
48 | }
49 |
50 | STATUS_LABEL = LABEL_STATUS.invert
51 |
52 | def self.find_status label
53 | LABEL_STATUS[label]
54 | end
55 |
56 | def self.find_label status
57 | STATUS_LABEL[status]
58 | end
59 | end
60 | end
61 |
62 |
--------------------------------------------------------------------------------
/test/exoplanets/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The change you wanted was rejected.
54 |
Maybe you tried to change something you didn't have access to.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/test/exoplanets/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The page you were looking for doesn't exist.
54 |
You may have mistyped the address or the page may have moved.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/VignetteShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Vignette shader
5 | * based on PaintEffect postprocess from ro.me
6 | * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
7 | */
8 |
9 | THREE.VignetteShader = {
10 |
11 | uniforms: {
12 |
13 | "tDiffuse": { type: "t", value: null },
14 | "offset": { type: "f", value: 1.0 },
15 | "darkness": { type: "f", value: 1.0 }
16 |
17 | },
18 |
19 | vertexShader: [
20 |
21 | "varying vec2 vUv;",
22 |
23 | "void main() {",
24 |
25 | "vUv = uv;",
26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
27 |
28 | "}"
29 |
30 | ].join("\n"),
31 |
32 | fragmentShader: [
33 |
34 | "uniform float offset;",
35 | "uniform float darkness;",
36 |
37 | "uniform sampler2D tDiffuse;",
38 |
39 | "varying vec2 vUv;",
40 |
41 | "void main() {",
42 |
43 | // Eskil's vignette
44 |
45 | "vec4 texel = texture2D( tDiffuse, vUv );",
46 | "vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
47 | "gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
48 |
49 | /*
50 | // alternative version from glfx.js
51 | // this one makes more "dusty" look (as opposed to "burned")
52 |
53 | "vec4 color = texture2D( tDiffuse, vUv );",
54 | "float dist = distance( vUv, vec2( 0.5 ) );",
55 | "color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
56 | "gl_FragColor = color;",
57 | */
58 |
59 | "}"
60 |
61 | ].join("\n")
62 |
63 | };
64 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/BleachBypassShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass]
5 | * - based on Nvidia example
6 | * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass
7 | */
8 |
9 | THREE.BleachBypassShader = {
10 |
11 | uniforms: {
12 |
13 | "tDiffuse": { type: "t", value: null },
14 | "opacity": { type: "f", value: 1.0 }
15 |
16 | },
17 |
18 | vertexShader: [
19 |
20 | "varying vec2 vUv;",
21 |
22 | "void main() {",
23 |
24 | "vUv = uv;",
25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26 |
27 | "}"
28 |
29 | ].join("\n"),
30 |
31 | fragmentShader: [
32 |
33 | "uniform float opacity;",
34 |
35 | "uniform sampler2D tDiffuse;",
36 |
37 | "varying vec2 vUv;",
38 |
39 | "void main() {",
40 |
41 | "vec4 base = texture2D( tDiffuse, vUv );",
42 |
43 | "vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );",
44 | "float lum = dot( lumCoeff, base.rgb );",
45 | "vec3 blend = vec3( lum );",
46 |
47 | "float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );",
48 |
49 | "vec3 result1 = 2.0 * base.rgb * blend;",
50 | "vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );",
51 |
52 | "vec3 newColor = mix( result1, result2, L );",
53 |
54 | "float A2 = opacity * base.a;",
55 | "vec3 mixRGB = A2 * newColor.rgb;",
56 | "mixRGB += ( ( 1.0 - A2 ) * base.rgb );",
57 |
58 | "gl_FragColor = vec4( mixRGB, base.a );",
59 |
60 | "}"
61 |
62 | ].join("\n")
63 |
64 | };
65 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/DotScreenShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Dot screen shader
5 | * based on glfx.js sepia shader
6 | * https://github.com/evanw/glfx.js
7 | */
8 |
9 | THREE.DotScreenShader = {
10 |
11 | uniforms: {
12 |
13 | "tDiffuse": { type: "t", value: null },
14 | "tSize": { type: "v2", value: new THREE.Vector2( 256, 256 ) },
15 | "center": { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
16 | "angle": { type: "f", value: 1.57 },
17 | "scale": { type: "f", value: 1.0 }
18 |
19 | },
20 |
21 | vertexShader: [
22 |
23 | "varying vec2 vUv;",
24 |
25 | "void main() {",
26 |
27 | "vUv = uv;",
28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
29 |
30 | "}"
31 |
32 | ].join("\n"),
33 |
34 | fragmentShader: [
35 |
36 | "uniform vec2 center;",
37 | "uniform float angle;",
38 | "uniform float scale;",
39 | "uniform vec2 tSize;",
40 |
41 | "uniform sampler2D tDiffuse;",
42 |
43 | "varying vec2 vUv;",
44 |
45 | "float pattern() {",
46 |
47 | "float s = sin( angle ), c = cos( angle );",
48 |
49 | "vec2 tex = vUv * tSize - center;",
50 | "vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
51 |
52 | "return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
53 |
54 | "}",
55 |
56 | "void main() {",
57 |
58 | "vec4 color = texture2D( tDiffuse, vUv );",
59 |
60 | "float average = ( color.r + color.g + color.b ) / 3.0;",
61 |
62 | "gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
63 |
64 | "}"
65 |
66 | ].join("\n")
67 |
68 | };
69 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/FilmPass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) {
6 |
7 | if ( THREE.FilmShader === undefined )
8 | console.error( "THREE.FilmPass relies on THREE.FilmShader" );
9 |
10 | var shader = THREE.FilmShader;
11 |
12 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
13 |
14 | this.material = new THREE.ShaderMaterial( {
15 |
16 | uniforms: this.uniforms,
17 | vertexShader: shader.vertexShader,
18 | fragmentShader: shader.fragmentShader
19 |
20 | } );
21 |
22 | if ( grayscale !== undefined ) this.uniforms.grayscale.value = grayscale;
23 | if ( noiseIntensity !== undefined ) this.uniforms.nIntensity.value = noiseIntensity;
24 | if ( scanlinesIntensity !== undefined ) this.uniforms.sIntensity.value = scanlinesIntensity;
25 | if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount;
26 |
27 | this.enabled = true;
28 | this.renderToScreen = false;
29 | this.needsSwap = true;
30 |
31 | };
32 |
33 | THREE.FilmPass.prototype = {
34 |
35 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
36 |
37 | this.uniforms[ "tDiffuse" ].value = readBuffer;
38 | this.uniforms[ "time" ].value += delta;
39 |
40 | THREE.EffectComposer.quad.material = this.material;
41 |
42 | if ( this.renderToScreen ) {
43 |
44 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera );
45 |
46 | } else {
47 |
48 | renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, writeBuffer, false );
49 |
50 | }
51 |
52 | }
53 |
54 | };
55 |
--------------------------------------------------------------------------------
/test/exoplanets/db/migrate/20130813213228_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | class DeviseCreateUsers < ActiveRecord::Migration
2 | def change
3 | create_table(:users) do |t|
4 | ## Database authenticatable
5 | t.string :email, :null => false, :default => ""
6 | t.string :encrypted_password, :null => false, :default => ""
7 |
8 | ## Recoverable
9 | t.string :reset_password_token
10 | t.datetime :reset_password_sent_at
11 |
12 | ## Rememberable
13 | t.datetime :remember_created_at
14 |
15 | ## Trackable
16 | t.integer :sign_in_count, :default => 0
17 | t.datetime :current_sign_in_at
18 | t.datetime :last_sign_in_at
19 | t.string :current_sign_in_ip
20 | t.string :last_sign_in_ip
21 |
22 | ## Confirmable
23 | # t.string :confirmation_token
24 | # t.datetime :confirmed_at
25 | # t.datetime :confirmation_sent_at
26 | # t.string :unconfirmed_email # Only if using reconfirmable
27 |
28 | ## Lockable
29 | # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
30 | # t.string :unlock_token # Only if unlock strategy is :email or :both
31 | # t.datetime :locked_at
32 |
33 | ## Token authenticatable
34 | # t.string :authentication_token
35 |
36 | t.timestamps
37 | end
38 |
39 | add_index :users, :email, :unique => true
40 | add_index :users, :reset_password_token, :unique => true
41 | # add_index :users, :confirmation_token, :unique => true
42 | # add_index :users, :unlock_token, :unique => true
43 | # add_index :users, :authentication_token, :unique => true
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/planets/orbitable.js.coffee:
--------------------------------------------------------------------------------
1 | class ex.Orbitable
2 | constructor: (@lat=0,
3 | @lng=0,
4 | @lngVelocity=0,
5 | @latVelocity=0,
6 | @altitude=0) ->
7 |
8 | build: ->
9 | @node = document.createElement 'div'
10 | @shadowNode = document.createElement 'div'
11 |
12 | @node.className = @getClassName()
13 | @shadowNode.className = 'shadow'
14 |
15 | [@node, @shadowNode]
16 |
17 | getClassName: -> 'cloud'
18 |
19 | animate: (t) ->
20 | @lng += @lngVelocity * t
21 | @lat += @latVelocity * t
22 |
23 | @lng = -180 if @lng > 180
24 | @lng = 180 if @lng < -180
25 | @lat = -180 if @lat > 180
26 | @lat = 180 if @lat < -180
27 |
28 | x = Math.sin(ex.deg2rad @lat) * (128 + @altitude) * Math.abs Math.sin(ex.deg2rad 90+@lng)
29 | y = Math.cos(ex.deg2rad 90+@lng) * (128 + @altitude)
30 | xShadow = Math.sin(ex.deg2rad @lat) * 128 * Math.abs Math.sin(ex.deg2rad 90+@lng)
31 | yShadow = Math.cos(ex.deg2rad 90+@lng) * 128
32 | dist = Math.max(Math.sqrt(x*x + y*y) - @altitude, 0)
33 | rotate = Math.atan2 y, x
34 | front = 90 >= @lat >= -90
35 | zindex = if front then 10 + Math.round(128 - dist) else 0
36 |
37 | @node.setAttribute 'style', """
38 | top: #{128+y}px;
39 | left: #{128+x}px;
40 | z-index: #{zindex};
41 | #{@getStyle front, x, y, rotate, dist}
42 | """.replace /\s+/g, ' '
43 |
44 | @shadowNode.setAttribute 'style', """
45 | top: #{128+yShadow}px;
46 | left: #{128+xShadow}px;
47 | z-index: #{if front then 1 else -1};
48 | #{@getShadowStyle front, x, y, rotate, dist}
49 | """.replace /\s+/g, ' '
50 |
--------------------------------------------------------------------------------
/test/exoplanets/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Exoplanets::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = "public, max-age=3600"
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 | end
37 |
--------------------------------------------------------------------------------
/test/exoplanets/app/inputs/file_input.rb:
--------------------------------------------------------------------------------
1 | class FileInput < SimpleForm::Inputs::FileInput
2 |
3 | def input
4 | buffer = ''
5 | opts = input_html_options.merge(id: hidden_dom_id)
6 | buffer << @builder.hidden_field(:"#{attribute_name}_tmp", opts) if object.respond_to? :"#{attribute_name}_tmp"
7 | buffer << @builder.file_field(attribute_name, input_html_options)
8 | buffer << preview
9 | buffer.html_safe
10 | end
11 |
12 | def hidden_dom_id
13 | dup = self.dup
14 | "#{dup.__id__}_tmp"
15 | end
16 |
17 | def preview
18 | template.content_tag :div, class: 'preview' do
19 | if object.try("#{attribute_name}?")
20 | image= object.send(attribute_name)
21 | build_preview(image).html_safe
22 | else
23 | default_field_label
24 | end
25 | end
26 | end
27 |
28 | def default_field_label
29 | "#{input_html_options[:placeholder]}
".html_safe
30 | end
31 |
32 | def build_preview image
33 | version = get_version(image)
34 | if version.present?
35 | '' << template.image_tag(version) << field_label(image)
36 | else
37 | ""
38 | end
39 | end
40 |
41 | def get_version image
42 | if image.respond_to?(:thumb)
43 | image.thumb
44 | end
45 | end
46 |
47 | def field_label res
48 | s = "#{res.to_s.split('/').last}
"
49 | s += ""
53 |
54 | s.html_safe
55 | end
56 |
57 | end
58 |
--------------------------------------------------------------------------------
/test/exoplanets/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # p ActiveRecord::Base
6 | # p ActiveModel::ForbiddenAttributesProtection
7 | # ActiveRecord::Base.send :include, ActiveModel::ForbiddenAttributesProtection
8 |
9 | if defined?(Bundler)
10 | # If you precompile assets before deploying to production, use this line
11 | Bundler.require(*Rails.groups(:assets => %w(development test)))
12 | # If you want your assets lazily compiled in production, use this line
13 | # Bundler.require(:default, :assets, Rails.env)
14 | end
15 |
16 | module Exoplanets
17 | class Application < Rails::Application
18 |
19 | # don't generate RSpec tests for views and helpers
20 | config.generators do |g|
21 |
22 | g.test_framework :rspec, fixture: true
23 | g.fixture_replacement :factory_girl, dir: 'spec/factories'
24 |
25 |
26 | g.view_specs false
27 | g.helper_specs false
28 | end
29 |
30 | config.autoload_paths += Dir["#{config.root}/lib/**/"]
31 |
32 | # Settings in config/environments/* take precedence over those specified here.
33 | # Application configuration should go into files in config/initializers
34 | # -- all .rb files in that directory are automatically loaded.
35 |
36 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
37 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
38 | # config.time_zone = 'Central Time (US & Canada)'
39 |
40 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
41 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
42 | # config.i18n.default_locale = :de
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/inputs/_ranges.sass:
--------------------------------------------------------------------------------
1 | +for-types(range)
2 | height: 85px
3 |
4 | +after
5 | display: block
6 | background: $pad-color
7 | border: 0px solid $pad-border-color
8 | margin-left: $fib-11
9 | margin-right: $fib-4
10 | margin-top: -48px
11 | height: 13px
12 | position: relative
13 | z-index: 1
14 |
15 | border-bottom-width: 2px
16 |
17 | +box-shadow(0 1px 3px rgba(0,0,0,0.5))
18 | +border-radius(3px)
19 | +box-sizing(border-box)
20 | +webkit-only
21 | margin-top: -36px
22 |
23 | input
24 | padding: 0
25 | padding-left: $fib-11
26 | padding-right: $fib-4
27 | margin-top: -4px
28 |
29 | +range-track
30 | background: transparent
31 | border: none
32 |
33 | +box(100%, 64px)
34 |
35 | +range-thumb
36 | border: 0px solid $pad-border-color
37 | background: $pad-color
38 |
39 | +box(50px, 50px)
40 | +border-radius(50%)
41 | +box-sizing(border-box)
42 | +box-shadow(0 4px 0 $pad-border-color, 0 4px 3px rgba(0,0,0,0.5))
43 |
44 | +webkit-only
45 | margin-top: 0px
46 |
47 | output
48 | color: $color-grey-5
49 | // font-weight: 500
50 |
51 | +font-block(2, 2)
52 | +absolute($fib-8, $fib-7)
53 |
54 | .small &, &.small
55 | height: 36px
56 |
57 | &:after
58 | margin-left: $fib-11 + $fib-9
59 | border-bottom-width: 1px
60 | height: 6px
61 | margin-top: -24px
62 |
63 | input
64 | height: 36px
65 | padding-left: $fib-11 + $fib-9
66 |
67 | +range-thumb
68 | +box-shadow(0 2px 0 $pad-border-color, 0 2px 3px rgba(0,0,0,0.5))
69 | +box(24px, 24px)
70 |
71 | output
72 | +absolute($fib-4, $fib-11)
73 | +font-block(1.2, 1.3)
74 |
--------------------------------------------------------------------------------
/test/exoplanets/lib/exo/gradient.rb:
--------------------------------------------------------------------------------
1 | module Exo
2 | class Gradient
3 | attr_accessor :colors, :positions
4 |
5 | def initialize(options={})
6 | self.colors = options.delete(:colors)
7 | self.positions = options.delete(:positions)
8 | end
9 |
10 | def at(position)
11 | position = sanitize_position(position)
12 |
13 | start_index = start_index_at(position)
14 | end_index = end_index_at(position)
15 |
16 | start_color = colors[start_index]
17 | end_color = colors[end_index]
18 |
19 | start_position = positions[start_index]
20 | end_position = positions[end_index]
21 |
22 | if start_color && !end_color
23 | start_color
24 | elsif end_color && !start_color
25 | end_color
26 | else
27 | start_color.interpolate end_color, normalize(position, start_position, end_position)
28 | end
29 | end
30 |
31 | def normalize(val, min, max)
32 | (val.to_f - min.to_f) / (max.to_f - min.to_f)
33 | end
34 |
35 | def start_index_at(position)
36 | position = sanitize_position(position)
37 |
38 | self.positions.reverse_each.with_index do |pos, i|
39 | return self.positions.size - i - 1 if pos <= position
40 | end
41 |
42 | 0
43 | end
44 |
45 | def end_index_at(position)
46 | position = sanitize_position(position)
47 |
48 | self.positions.each_with_index do |pos, i|
49 | return i if pos >= position
50 | end
51 |
52 | self.positions.size - 1
53 | end
54 |
55 | def valid_position?(position)
56 | position >= 0 && position <= 1
57 | end
58 |
59 | def sanitize_position(position)
60 | return 0.0 if position < 0
61 | return 1.0 if position > 1
62 | position.to_f
63 | end
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/common/_colors.sass:
--------------------------------------------------------------------------------
1 |
2 | $color-grey-1: #e3f8f6
3 | $color-grey-2: #d4ebeb
4 | $color-grey-3: #bcd7d9
5 | $color-grey-4: #bfdadb
6 | $color-grey-5: #a9c7ca
7 | $color-grey-6: #7ea4aa
8 | $color-grey-7: #728992
9 | $color-grey-8: #435762
10 | $color-grey-9: #2d3b45
11 | $color-grey-10: #172430
12 |
13 | $color-blue-very-dark: #101c28
14 | $color-blue-dark: #082e43
15 | $color-blue-medium: #045573
16 | $color-blue-light: #01aef0
17 |
18 | $color-green-medium: #57a71c
19 | $color-green-light: #6cff00
20 |
21 | $color-yellow-medium: #8ec63d
22 | $color-yellow-light: #c4fe13
23 |
24 | $color-red-medium: #c73f7d
25 | $color-red-light: #ff729c
26 |
27 | $pad-color: $color-grey-2
28 | $pad-hover-color: $color-grey-1
29 | $pad-border-color: $color-grey-6
30 | $pad-text-color: $color-grey-9
31 | $pad-shadow-color: transparentize($color-blue-dark, 0.3)
32 | $pad-shadow: 0 2px 4px $pad-shadow-color
33 | $pad-inner-shadow: inset 0 1px 4px $pad-shadow-color
34 | $pad-arrow-shadow: 2px -1px 2px -1px $pad-shadow-color
35 | $pad-arrow-inner-shadow: inset -1px 2px 2px -1px $pad-shadow-color
36 |
37 | $card-color: $color-grey-1
38 | $card-border-color: $color-grey-4
39 | $card-dark-color: $color-blue-medium
40 | $card-dark-border-color: $color-blue-very-dark
41 | $card-light-text-color: $color-grey-4
42 | $card-dark-text-color: $color-grey-8
43 | $card-shadow-color: transparentize($color-blue-dark, 0.6)
44 | $card-shadow: 0 2px 6px $card-shadow-color
45 |
46 | @function hover-color($color)
47 | @return lighten(saturate($color, 5), 10)
48 |
49 | @function disabled-color($color)
50 | @return lighten(desaturate($color, 70), 10)
51 |
52 | @function disabled-border-color($color)
53 | @return lighten(desaturate($color, 70), 15)
54 |
55 | @function disabled-text-color($color)
56 | @return lighten(desaturate($color, 70), 20)
57 |
--------------------------------------------------------------------------------
/test/exoplanets/app/controllers/admin/application_controller.rb:
--------------------------------------------------------------------------------
1 | class Admin::ApplicationController < ApplicationController
2 | control_and_rescue_traffic
3 |
4 | layout 'admin'
5 | respond_to :html
6 |
7 | helper_method :resource_class, :resource_name, :resource_collection, :resource
8 |
9 | before_filter :authenticate_admin!
10 |
11 | def access_denied
12 | current_user ? forbidden : unauthorized
13 | end
14 |
15 | def forbidden
16 | redirect_to new_user_session_path, status: 403
17 | end
18 |
19 | def unauthorized
20 | redirect_to new_user_session_path
21 | end
22 |
23 | def controller_scope
24 | [:admin]
25 | end
26 |
27 | def resource_location action=nil
28 | case action
29 | when :create then controller_scope << resource
30 | when :update then controller_scope << resource
31 | else
32 | controller_scope << resource_name.to_s.pluralize.to_sym
33 | end
34 | end
35 |
36 | def resource_path_for res, action=nil
37 | plural = resource_name.to_s.pluralize.to_sym
38 |
39 | if action.present?
40 | action = action.to_s
41 | else
42 | action = params[:action]
43 | end
44 |
45 | case action
46 | when 'update' then controller_scope + [res]
47 | when 'create' then controller_scope + [plural]
48 | when 'index' then controller_scope + [plural]
49 | when 'destroy' then controller_scope + [res]
50 | when 'show' then controller_scope + [res]
51 | when 'new' then [:new] + controller_scope + [resource_name]
52 | else
53 | [action.to_sym] + controller_scope + [res]
54 | end
55 | end
56 |
57 | def resource_path action=nil
58 | resource_path_for resource, action
59 | end
60 |
61 | private
62 |
63 | def authenticate_admin!
64 | authenticate_user!
65 | forbidden unless current_user.has_role? :admin
66 | end
67 |
68 | end
69 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_session.sass:
--------------------------------------------------------------------------------
1 |
2 | #session
3 | .fn
4 | color: $color-grey-6
5 |
6 | .roles
7 | margin-top: 2px
8 | margin-bottom: 8px
9 |
10 | .email, .message
11 | margin-bottom: 8px
12 | color: $color-grey-8
13 |
14 | .avatar
15 | float: right
16 | margin-left: 8px
17 | margin-top: 3px
18 |
19 | figure
20 | cursor: pointer
21 | position: relative
22 | background: $color-grey-9
23 | border: 1px solid $color-grey-8
24 | font-size: $avatar-size
25 | line-height: $avatar-size
26 | text-align: center
27 | overflow: hidden
28 |
29 | +transition(all 0.3s)
30 | +box($avatar-size, $avatar-size)
31 | +border-radius(8px)
32 |
33 | &:before
34 | content: "\f007"
35 | font-family: $font-awesome
36 | z-index: 1
37 |
38 | +absolute
39 | +box(100%, 100%)
40 |
41 | &:hover
42 | color: $color-grey-7
43 | border-color: $color-grey-7
44 | background: $color-grey-8
45 |
46 | img
47 | position: relative
48 | z-index: 2
49 |
50 | .item.user
51 | padding-left: 50px + $fib-6
52 | .avatar
53 | +absolute($fib-5)
54 |
55 | figure
56 | position: relative
57 | background: $color-grey-2
58 | color: $color-grey-5
59 | border: 1px solid $color-grey-5
60 | font-size: $avatar-small-size
61 | line-height: $avatar-small-size
62 | text-align: center
63 | overflow: hidden
64 |
65 | +transition(all 0.3s)
66 | +box($avatar-small-size, $avatar-small-size)
67 | +border-radius(8px)
68 |
69 | &:before
70 | content: "\f007"
71 | font-family: $font-awesome
72 | z-index: 1
73 |
74 | +absolute
75 | +box(100%, 100%)
76 |
77 | img
78 | position: relative
79 | z-index: 2
80 |
--------------------------------------------------------------------------------
/test/exoplanets/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 | ruby '2.0.0'
3 |
4 | gem 'rails', '4.0.0'
5 | gem 'turbolinks'
6 | gem 'jbuilder', '~> 1.2'
7 | gem 'figaro'
8 | gem 'pg'
9 | gem 'unicorn'
10 | gem 'pry-rails'
11 |
12 | # Users/Rights
13 | gem 'devise'
14 | gem 'cancan'
15 | gem 'rolify'
16 | gem 'pwdcalc'
17 |
18 | # Traffic
19 | gem 'customs'
20 |
21 | # Models
22 | gem 'enumerize'
23 | gem 'seed-fu'
24 | gem 'kaminari'
25 |
26 | # S3
27 | gem 'carrierwave'
28 | gem 'carrierwave-meta'
29 | gem 'aws-sdk'
30 | gem 'fog'
31 |
32 | # Graphics
33 | gem 'rmagick'
34 | gem 'perlin'
35 |
36 | # Delayed Jobs
37 | gem 'delayed_job'
38 | gem 'delayed_job_active_record'
39 |
40 | # HTML
41 | gem 'haml-rails'
42 | gem 'simple_form', '>= 3.0.0.rc'
43 |
44 | # Assets
45 | gem 'jquery-rails'
46 |
47 | group :development do
48 | # Errors
49 | gem 'better_errors'
50 | gem 'binding_of_caller', platforms: [:mri_19, :mri_20, :rbx]
51 |
52 | # Assets
53 | gem 'html2haml'
54 | gem 'quiet_assets'
55 |
56 | # Guard
57 | gem 'guard-bundler'
58 | gem 'guard-rails'
59 | gem 'guard-rspec'
60 | gem 'guard-spork'
61 | gem 'guard-livereload'
62 |
63 | # Spork
64 | gem 'spork-rails', github: 'sporkrb/spork-rails'
65 |
66 | # Notification
67 | gem 'rb-fchange', require: false
68 | gem 'rb-fsevent', require: false
69 | gem 'rb-inotify', require: false
70 | end
71 |
72 | group :development, :test do
73 | gem 'factory_girl_rails'
74 | gem 'rspec-rails'
75 | end
76 |
77 | group :test do
78 | gem 'capybara'
79 | gem 'database_cleaner'
80 | gem 'email_spec'
81 | gem 'shoulda-matchers'
82 | gem 'faker'
83 | gem 'nyan-cat-formatter'
84 | end
85 |
86 | group :assets do
87 | gem 'coffee-rails', '~> 4.0.0'
88 | gem 'uglifier', '>= 1.0.3'
89 | gem 'sass-rails', '~> 4.0.0'
90 | gem 'compass-rails', github: 'milgner/compass-rails', ref: '1749c06f15dc4b058427e7969810457213647fb8'
91 | gem 'purecss-rails'
92 | end
93 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/inputs/dates.sass:
--------------------------------------------------------------------------------
1 |
2 | +for-types(datetime)
3 | color: $color-grey-5
4 | padding: $fib-7 + 4px $fib-7 0 $fib-7
5 | background: $color-blue-dark
6 | height: 85px
7 |
8 | +box-shadow(inset 0 2px 3px rgba(0,0,0,0.5))
9 | +font-block(2, 3)
10 |
11 | &:not(.checkbox):not(.radio):before
12 | content: none
13 |
14 | &.focus:not(.checkbox):not(.radio)
15 | background: $color-blue-medium
16 |
17 | .select:before
18 | background: $color-blue-medium
19 |
20 | .select:after
21 | color: $color-blue-light
22 |
23 | .select
24 | border-bottom: 1px solid $color-blue-light
25 |
26 | label
27 | left: 0
28 |
29 | .select
30 | display: inline-block
31 | position: relative
32 | padding-right: 4px
33 | border-bottom: 1px solid $color-blue-medium
34 |
35 | +transition(all 0.3s)
36 |
37 | +before
38 | background: $color-blue-dark
39 | right: 0
40 | width: 20px
41 | height: 100%
42 |
43 | +transition(all 0.3s)
44 | +absolute(0, inherit)
45 |
46 | +after('\f078')
47 | font-family: $font-awesome
48 | color: $color-blue-medium
49 | right: 0
50 |
51 | +transition(all 0.3s)
52 | +font-block(1, 3)
53 | +absolute(0, inherit)
54 |
55 | &:not(.disabled)
56 | .select:hover
57 | border-color: $color-blue-light
58 |
59 | &:after
60 | color: $color-blue-light
61 |
62 | select
63 | color: $color-grey-4
64 |
65 | select
66 | background: transparent
67 | border: none
68 | color: $color-grey-5
69 | font-weight: 300
70 |
71 | +transition(all 0.5s)
72 |
73 | .small &, &.small
74 | height: 36px
75 | padding: $fib-2 $fib-3 $fib-2 $fib-11
76 |
77 | +font-block(1, 1.5)
78 |
79 | .select
80 | margin-top: -20px
81 | +font-block(1, 1.5)
82 |
83 | &:after
84 | +font-block(0.6, 1.5)
85 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/HueSaturationShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author tapio / http://tapio.github.com/
3 | *
4 | * Hue and saturation adjustment
5 | * https://github.com/evanw/glfx.js
6 | * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.
7 | * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
8 | */
9 |
10 | THREE.HueSaturationShader = {
11 |
12 | uniforms: {
13 |
14 | "tDiffuse": { type: "t", value: null },
15 | "hue": { type: "f", value: 0 },
16 | "saturation": { type: "f", value: 0 }
17 |
18 | },
19 |
20 | vertexShader: [
21 |
22 | "varying vec2 vUv;",
23 |
24 | "void main() {",
25 |
26 | "vUv = uv;",
27 |
28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
29 |
30 | "}"
31 |
32 | ].join("\n"),
33 |
34 | fragmentShader: [
35 |
36 | "uniform sampler2D tDiffuse;",
37 | "uniform float hue;",
38 | "uniform float saturation;",
39 |
40 | "varying vec2 vUv;",
41 |
42 | "void main() {",
43 |
44 | "gl_FragColor = texture2D( tDiffuse, vUv );",
45 |
46 | // hue
47 | "float angle = hue * 3.14159265;",
48 | "float s = sin(angle), c = cos(angle);",
49 | "vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
50 | "float len = length(gl_FragColor.rgb);",
51 | "gl_FragColor.rgb = vec3(",
52 | "dot(gl_FragColor.rgb, weights.xyz),",
53 | "dot(gl_FragColor.rgb, weights.zxy),",
54 | "dot(gl_FragColor.rgb, weights.yzx)",
55 | ");",
56 |
57 | // saturation
58 | "float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
59 | "if (saturation > 0.0) {",
60 | "gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
61 | "} else {",
62 | "gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
63 | "}",
64 |
65 | "}"
66 |
67 | ].join("\n")
68 |
69 | };
70 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/VerticalBlurShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author zz85 / http://www.lab4games.net/zz85/blog
3 | *
4 | * Two pass Gaussian blur filter (horizontal and vertical blur shaders)
5 | * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
6 | * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
7 | *
8 | * - 9 samples per pass
9 | * - standard deviation 2.7
10 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
11 | */
12 |
13 | THREE.VerticalBlurShader = {
14 |
15 | uniforms: {
16 |
17 | "tDiffuse": { type: "t", value: null },
18 | "v": { type: "f", value: 1.0 / 512.0 }
19 |
20 | },
21 |
22 | vertexShader: [
23 |
24 | "varying vec2 vUv;",
25 |
26 | "void main() {",
27 |
28 | "vUv = uv;",
29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
30 |
31 | "}"
32 |
33 | ].join("\n"),
34 |
35 | fragmentShader: [
36 |
37 | "uniform sampler2D tDiffuse;",
38 | "uniform float v;",
39 |
40 | "varying vec2 vUv;",
41 |
42 | "void main() {",
43 |
44 | "vec4 sum = vec4( 0.0 );",
45 |
46 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
47 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
48 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
49 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
51 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
52 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
54 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
55 |
56 | "gl_FragColor = sum;",
57 |
58 | "}"
59 |
60 | ].join("\n")
61 |
62 | };
63 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/HorizontalBlurShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author zz85 / http://www.lab4games.net/zz85/blog
3 | *
4 | * Two pass Gaussian blur filter (horizontal and vertical blur shaders)
5 | * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
6 | * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
7 | *
8 | * - 9 samples per pass
9 | * - standard deviation 2.7
10 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
11 | */
12 |
13 | THREE.HorizontalBlurShader = {
14 |
15 | uniforms: {
16 |
17 | "tDiffuse": { type: "t", value: null },
18 | "h": { type: "f", value: 1.0 / 512.0 }
19 |
20 | },
21 |
22 | vertexShader: [
23 |
24 | "varying vec2 vUv;",
25 |
26 | "void main() {",
27 |
28 | "vUv = uv;",
29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
30 |
31 | "}"
32 |
33 | ].join("\n"),
34 |
35 | fragmentShader: [
36 |
37 | "uniform sampler2D tDiffuse;",
38 | "uniform float h;",
39 |
40 | "varying vec2 vUv;",
41 |
42 | "void main() {",
43 |
44 | "vec4 sum = vec4( 0.0 );",
45 |
46 | "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
47 | "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
48 | "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
49 | "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
51 | "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
52 | "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
53 | "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
54 | "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
55 |
56 | "gl_FragColor = sum;",
57 |
58 | "}"
59 |
60 | ].join("\n")
61 |
62 | };
63 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/TriangleBlurShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author zz85 / http://www.lab4games.net/zz85/blog
3 | *
4 | * Triangle blur shader
5 | * based on glfx.js triangle blur shader
6 | * https://github.com/evanw/glfx.js
7 | *
8 | * A basic blur filter, which convolves the image with a
9 | * pyramid filter. The pyramid filter is separable and is applied as two
10 | * perpendicular triangle filters.
11 | */
12 |
13 | THREE.TriangleBlurShader = {
14 |
15 | uniforms : {
16 |
17 | "texture": { type: "t", value: null },
18 | "delta": { type: "v2", value:new THREE.Vector2( 1, 1 ) }
19 |
20 | },
21 |
22 | vertexShader: [
23 |
24 | "varying vec2 vUv;",
25 |
26 | "void main() {",
27 |
28 | "vUv = uv;",
29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
30 |
31 | "}"
32 |
33 | ].join("\n"),
34 |
35 | fragmentShader: [
36 |
37 | "#define ITERATIONS 10.0",
38 |
39 | "uniform sampler2D texture;",
40 | "uniform vec2 delta;",
41 |
42 | "varying vec2 vUv;",
43 |
44 | "float random( vec3 scale, float seed ) {",
45 |
46 | // use the fragment position for a different seed per-pixel
47 |
48 | "return fract( sin( dot( gl_FragCoord.xyz + seed, scale ) ) * 43758.5453 + seed );",
49 |
50 | "}",
51 |
52 | "void main() {",
53 |
54 | "vec4 color = vec4( 0.0 );",
55 |
56 | "float total = 0.0;",
57 |
58 | // randomize the lookup values to hide the fixed number of samples
59 |
60 | "float offset = random( vec3( 12.9898, 78.233, 151.7182 ), 0.0 );",
61 |
62 | "for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
63 |
64 | "float percent = ( t + offset - 0.5 ) / ITERATIONS;",
65 | "float weight = 1.0 - abs( percent );",
66 |
67 | "color += texture2D( texture, vUv + delta * percent ) * weight;",
68 | "total += weight;",
69 |
70 | "}",
71 |
72 | "gl_FragColor = color / total;",
73 |
74 | "}"
75 |
76 | ].join("\n")
77 |
78 | };
79 |
--------------------------------------------------------------------------------
/test/exoplanets/.gitignore:
--------------------------------------------------------------------------------
1 | #----------------------------------------------------------------------------
2 | # Ignore these files when commiting to a git repository.
3 | #
4 | # See http://help.github.com/ignore-files/ for more about ignoring files.
5 | #
6 | # The original version of this file is found here:
7 | # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt
8 | #
9 | # Corrections? Improvements? Create a GitHub issue:
10 | # http://github.com/RailsApps/rails-composer/issues
11 | #----------------------------------------------------------------------------
12 |
13 | # bundler state
14 | /.bundle
15 | /vendor/bundle/
16 | /vendor/ruby/
17 |
18 | # minimal Rails specific artifacts
19 | db/*.sqlite3
20 | /log/*
21 | /tmp/*
22 |
23 | # various artifacts
24 | **.war
25 | *.rbc
26 | *.sassc
27 | .rspec
28 | .redcar/
29 | .sass-cache
30 | /config/config.yml
31 | /config/database.yml
32 | /coverage.data
33 | /coverage/
34 | /db/*.javadb/
35 | /db/*.sqlite3
36 | /doc/api/
37 | /doc/app/
38 | /doc/features.html
39 | /doc/specs.html
40 | /public/cache
41 | /public/stylesheets/compiled
42 | /public/system/*
43 | /public/uploads/*
44 | /public/images/*
45 | /spec/tmp/*
46 | /cache
47 | /capybara*
48 | /capybara-*.html
49 | /gems
50 | /specifications
51 | rerun.txt
52 | pickle-email-*.html
53 |
54 | # If you find yourself ignoring temporary files generated by your text editor
55 | # or operating system, you probably want to add a global ignore instead:
56 | # git config --global core.excludesfile ~/.gitignore_global
57 | #
58 | # Here are some files you may want to ignore globally:
59 |
60 | # scm revert files
61 | **.orig
62 |
63 | # Mac finder artifacts
64 | .DS_Store
65 |
66 | # Netbeans project directory
67 | /nbproject/
68 |
69 | # RubyMine project files
70 | .idea
71 |
72 | # Textmate project files
73 | /*.tmproj
74 |
75 | # vim artifacts
76 | **.swp
77 |
78 | # sublime artifacts
79 | *.sublime-*
80 |
81 | # Ignore application configuration
82 | /config/application.yml
83 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/support/helpers/session_helper.rb:
--------------------------------------------------------------------------------
1 | module SessionHelper
2 | extend BaseHelper
3 |
4 | module ExampleMethods
5 | def setup_devise
6 | @request.env["devise.mapping"] = Devise.mappings[:user]
7 | end
8 |
9 | def login user
10 | user = FactoryGirl.create(user) if user.is_a? Symbol
11 |
12 | @current_user = user
13 | setup_devise
14 | sign_in user
15 | end
16 |
17 | def auth user, opts={}
18 | user = FactoryGirl.create(user) if user.is_a? Symbol
19 | ActiveSupport::OptionMerger.new self, opts.merge(auth_token: user.authentication_token)
20 | end
21 |
22 | def json opts={}
23 | ActiveSupport::OptionMerger.new self, opts.merge(format: :json)
24 | end
25 |
26 | def json_response
27 | response.body && JSON.parse(response.body)
28 | end
29 | end
30 |
31 | module ExampleGroupMethods
32 | def as_user(options={})
33 | {
34 | factory: :user,
35 | label: 'user'
36 | }.merge(options)
37 | end
38 |
39 | def as_admin(options={})
40 | {
41 | factory: :admin,
42 | label: 'admin'
43 | }.merge(options)
44 | end
45 |
46 | def when_logged_in(options={}, &block)
47 |
48 | if options[:as].present?
49 | label = factory = options[:as]
50 | traits = []
51 | elsif options[:factory].present?
52 | factory = options[:factory]
53 | label = options[:label] || factory
54 | traits = options[:traits] || []
55 | else
56 | label = factory = :user
57 | traits = []
58 | end
59 |
60 | proc = options[:do]
61 |
62 | context "when logged in as #{label}" do
63 | let(:user) do
64 | u = create factory, *traits
65 | proc.bind(self).call(u) if proc
66 | u
67 | end
68 |
69 | before(:each) { sign_in user }
70 |
71 | context('', &block) if block_given?
72 | end
73 | end
74 | end
75 | end
76 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/EdgeShader2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author zz85 / https://github.com/zz85 | https://www.lab4games.net/zz85/blog
3 | *
4 | * Edge Detection Shader using Sobel filter
5 | * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector
6 | *
7 | * aspect: vec2 of (1/width, 1/height)
8 | */
9 |
10 | THREE.EdgeShader2 = {
11 |
12 | uniforms: {
13 |
14 | "tDiffuse": { type: "t", value: null },
15 | "aspect": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
16 | },
17 |
18 | vertexShader: [
19 |
20 | "varying vec2 vUv;",
21 |
22 | "void main() {",
23 |
24 | "vUv = uv;",
25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26 |
27 | "}"
28 |
29 | ].join("\n"),
30 |
31 | fragmentShader: [
32 |
33 | "uniform sampler2D tDiffuse;",
34 | "varying vec2 vUv;",
35 | "uniform vec2 aspect;",
36 |
37 |
38 | "vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);",
39 |
40 | "mat3 G[2];",
41 |
42 | "const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );",
43 | "const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );",
44 |
45 |
46 | "void main(void)",
47 | "{",
48 | "mat3 I;",
49 | "float cnv[2];",
50 | "vec3 sample;",
51 |
52 | "G[0] = g0;",
53 | "G[1] = g1;",
54 |
55 | /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
56 | "for (float i=0.0; i<3.0; i++)",
57 | "for (float j=0.0; j<3.0; j++) {",
58 | "sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
59 | "I[int(i)][int(j)] = length(sample);",
60 | "}",
61 |
62 | /* calculate the convolution values for all the masks */
63 | "for (int i=0; i<2; i++) {",
64 | "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
65 | "cnv[i] = dp3 * dp3; ",
66 | "}",
67 |
68 | "gl_FragColor = vec4(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));",
69 | "} ",
70 |
71 | ].join("\n")
72 |
73 | };
74 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_lists.sass:
--------------------------------------------------------------------------------
1 | =ul-bullet()
2 | border-bottom: 2px solid $color-grey-6
3 | background: $color-grey-5
4 |
5 | +border-radius(50% 50% 0 50%)
6 | +box-shadow(0 1px 3px $color-grey-8)
7 | +box(20px, 20px)
8 |
9 | =ol-bullet()
10 | border-bottom: 2px solid $color-grey-6
11 | background: $color-grey-5
12 |
13 | +border-radius(50% 50% 0 50%)
14 | +box-shadow(0 1px 3px $color-grey-8)
15 |
16 |
17 | .ordered-list, .unordered-list
18 | padding: 0
19 | margin: $fib-6 $fib-5
20 |
21 | +font-block(1.6, 2.6)
22 |
23 | li
24 | list-style: none
25 | counter-increment: items
26 | position: relative
27 |
28 | @for $i from 1 through $colors-count
29 | $name: nth($colors-name, $i)
30 | $background: nth($colors-light, $i)
31 | $border: nth($colors-medium, $i)
32 |
33 | &.#{$name} li, li.#{$name}
34 | &:before
35 | background: $background
36 | border-color: $border
37 |
38 |
39 | .ordered-list
40 | li
41 | padding-left: 38px
42 |
43 | +before
44 | +absolute(50%)
45 | +ol-bullet
46 |
47 | +after(counter(items))
48 | background: $pad-color
49 | color: $color-grey-9
50 | border-top: 2px solid $color-grey-6
51 | margin-top: -14px
52 | text-align: center
53 | font-weight: 500
54 |
55 | +font-block(0.8, 1.4)
56 | +absolute(50%, 4px)
57 | +box(22px, 22px)
58 | +box-shadow(inset 0 1px 3px transparentize($color-grey-8, 0.3))
59 | +border-radius(50%)
60 |
61 | &:before
62 | margin-top: -17px
63 |
64 | +box(30px, 30px)
65 |
66 | @for $i from 1 through $colors-count
67 | $name: nth($colors-name, $i)
68 | $border: nth($colors-medium, $i)
69 |
70 | &.#{$name} li, li.#{$name}
71 | &:after
72 | border-color: $border
73 |
74 |
75 | .unordered-list
76 | li
77 | padding-left: 28px
78 |
79 | +before
80 | margin-top: -12px
81 |
82 | +absolute(50%)
83 | +ul-bullet
84 |
85 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/VerticalTiltShiftShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
5 | *
6 | * - 9 samples per pass
7 | * - standard deviation 2.7
8 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
9 | * - "r" parameter control where "focused" horizontal line lies
10 | */
11 |
12 | THREE.VerticalTiltShiftShader = {
13 |
14 | uniforms: {
15 |
16 | "tDiffuse": { type: "t", value: null },
17 | "v": { type: "f", value: 1.0 / 512.0 },
18 | "r": { type: "f", value: 0.35 }
19 |
20 | },
21 |
22 | vertexShader: [
23 |
24 | "varying vec2 vUv;",
25 |
26 | "void main() {",
27 |
28 | "vUv = uv;",
29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
30 |
31 | "}"
32 |
33 | ].join("\n"),
34 |
35 | fragmentShader: [
36 |
37 | "uniform sampler2D tDiffuse;",
38 | "uniform float v;",
39 | "uniform float r;",
40 |
41 | "varying vec2 vUv;",
42 |
43 | "void main() {",
44 |
45 | "vec4 sum = vec4( 0.0 );",
46 |
47 | "float vv = v * abs( r - vUv.y );",
48 |
49 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
51 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
52 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
54 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
55 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
56 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
57 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
58 |
59 | "gl_FragColor = sum;",
60 |
61 | "}"
62 |
63 | ].join("\n")
64 |
65 | };
66 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/HorizontalTiltShiftShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
5 | *
6 | * - 9 samples per pass
7 | * - standard deviation 2.7
8 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
9 | * - "r" parameter control where "focused" horizontal line lies
10 | */
11 |
12 | THREE.HorizontalTiltShiftShader = {
13 |
14 | uniforms: {
15 |
16 | "tDiffuse": { type: "t", value: null },
17 | "h": { type: "f", value: 1.0 / 512.0 },
18 | "r": { type: "f", value: 0.35 }
19 |
20 | },
21 |
22 | vertexShader: [
23 |
24 | "varying vec2 vUv;",
25 |
26 | "void main() {",
27 |
28 | "vUv = uv;",
29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
30 |
31 | "}"
32 |
33 | ].join("\n"),
34 |
35 | fragmentShader: [
36 |
37 | "uniform sampler2D tDiffuse;",
38 | "uniform float h;",
39 | "uniform float r;",
40 |
41 | "varying vec2 vUv;",
42 |
43 | "void main() {",
44 |
45 | "vec4 sum = vec4( 0.0 );",
46 |
47 | "float hh = h * abs( r - vUv.y );",
48 |
49 | "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
50 | "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
51 | "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
52 | "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
54 | "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
55 | "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
56 | "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
57 | "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
58 |
59 | "gl_FragColor = sum;",
60 |
61 | "}"
62 |
63 | ].join("\n")
64 |
65 | };
66 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/postprocessing/MaskPass.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | */
4 |
5 | THREE.MaskPass = function ( scene, camera ) {
6 |
7 | this.scene = scene;
8 | this.camera = camera;
9 |
10 | this.enabled = true;
11 | this.clear = true;
12 | this.needsSwap = false;
13 |
14 | this.inverse = false;
15 |
16 | };
17 |
18 | THREE.MaskPass.prototype = {
19 |
20 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
21 |
22 | var context = renderer.context;
23 |
24 | // don't update color or depth
25 |
26 | context.colorMask( false, false, false, false );
27 | context.depthMask( false );
28 |
29 | // set up stencil
30 |
31 | var writeValue, clearValue;
32 |
33 | if ( this.inverse ) {
34 |
35 | writeValue = 0;
36 | clearValue = 1;
37 |
38 | } else {
39 |
40 | writeValue = 1;
41 | clearValue = 0;
42 |
43 | }
44 |
45 | context.enable( context.STENCIL_TEST );
46 | context.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE );
47 | context.stencilFunc( context.ALWAYS, writeValue, 0xffffffff );
48 | context.clearStencil( clearValue );
49 |
50 | // draw into the stencil buffer
51 |
52 | renderer.render( this.scene, this.camera, readBuffer, this.clear );
53 | renderer.render( this.scene, this.camera, writeBuffer, this.clear );
54 |
55 | // re-enable update of color and depth
56 |
57 | context.colorMask( true, true, true, true );
58 | context.depthMask( true );
59 |
60 | // only render where stencil is set to 1
61 |
62 | context.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
63 | context.stencilOp( context.KEEP, context.KEEP, context.KEEP );
64 |
65 | }
66 |
67 | };
68 |
69 |
70 | THREE.ClearMaskPass = function () {
71 |
72 | this.enabled = true;
73 |
74 | };
75 |
76 | THREE.ClearMaskPass.prototype = {
77 |
78 | render: function ( renderer, writeBuffer, readBuffer, delta ) {
79 |
80 | var context = renderer.context;
81 |
82 | context.disable( context.STENCIL_TEST );
83 |
84 | }
85 |
86 | };
87 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 |
3 | module ActiveModel
4 | module Observing
5 | end
6 | end
7 |
8 | require 'spork'
9 | #uncomment the following line to use spork with the debugger
10 | #require 'spork/ext/ruby-debug'
11 |
12 | Spork.prefork do
13 | ENV["RAILS_ENV"] ||= 'test'
14 |
15 | require 'rails/application'
16 | Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
17 |
18 | require File.expand_path("../../config/environment", __FILE__)
19 | require 'rspec/rails'
20 | require 'rspec/autorun'
21 |
22 | # Requires supporting ruby files with custom matchers and macros, etc,
23 | # in spec/support/ and its subdirectories.
24 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
25 |
26 | root = Rails.root
27 |
28 | include ActionDispatch::TestProcess
29 |
30 | RSpec.configure do |config|
31 |
32 | config.include EmailSpec::Helpers
33 | config.include EmailSpec::Matchers
34 | config.include Devise::TestHelpers, :type => :controller
35 | config.include FactoryGirl::Syntax::Methods
36 |
37 | Dir[root.join("spec/support/matchers/*.rb")].each {|f| require f }
38 |
39 | require root.join('spec/support/helpers/base_helper.rb')
40 | Dir[root.join("spec/support/helpers/*.rb")].each do |f|
41 | const = f.split("/").last.split(".").first.classify.constantize
42 | RSpec::Core::ExampleGroup.send :include, const
43 | end
44 |
45 | I18n.locale = :en
46 |
47 | config.fixture_path = "#{root}/spec/fixtures"
48 |
49 | config.use_transactional_fixtures = true
50 |
51 | config.infer_base_class_for_anonymous_controllers = false
52 |
53 | config.alias_it_should_behave_like_to :it_should, "it should"
54 |
55 | config.order = "random"
56 |
57 | config.before(:suite) do
58 | DatabaseCleaner.strategy = :truncation
59 | end
60 | config.before(:each) do
61 | DatabaseCleaner.start
62 | end
63 | config.after(:each) do
64 | DatabaseCleaner.clean
65 | end
66 | end
67 | end
68 |
69 | Spork.each_run do
70 | FactoryGirl.reload
71 | end
72 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/lib/exo/color_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Exo::Color do
4 | all_options = [
5 | { red: 255, green: 0, blue: 0, alpha: 255 },
6 | { rgba: [255,0,0,255] },
7 | { rgb: [255, 0, 0] },
8 | { hex: 0xff0000 },
9 | { hex_argb: 0xffff0000 },
10 | { html: '#ff0000' },
11 | { html_argb: '#ffff0000' },
12 | { css_rgb: 'rgb(255,0,0)'},
13 | { css_rgba: 'rgba(255,0,0,1)'},
14 | { pixel: Magick::Pixel.new(Magick::QuantumRange, 0, 0, 0) },
15 | ]
16 |
17 | all_options.each do |options|
18 | context "created with #{options.keys.to_sentence} option" do
19 | subject { Exo::Color.new options }
20 |
21 | it{ should be_a_color(255, 0, 0, 255) }
22 | end
23 | end
24 |
25 | context "created with no option" do
26 | subject { Exo::Color.new }
27 |
28 | it{ should be_a_color(0, 0, 0, 255) }
29 | end
30 |
31 | context 'created with 0xffff0000' do
32 | let(:color) { Exo::Color.new hex_argb: 0xffff0000 }
33 |
34 | all_options.each do |options|
35 | options.keys.each do |key|
36 | describe "##{key}" do
37 | subject { color.send(key) }
38 |
39 | it{ should eq options[key] }
40 | end
41 | end
42 | end
43 |
44 | describe '#+' do
45 | let(:color2) { Exo::Color.new hex_argb: 0xff00ff00 }
46 | subject { color + color2 }
47 |
48 | it{ should be_a_color(255, 255, 0, 255) }
49 | end
50 |
51 | describe '#-' do
52 | let(:color2) { Exo::Color.new hex_argb: 0x88880088 }
53 | subject { color - color2 }
54 |
55 | it{ should be_a_color(119, 0, 0, 119) }
56 | end
57 |
58 | describe '#==' do
59 | subject { color == color2 }
60 |
61 | context 'with an equivalent color' do
62 | let(:color2) { Exo::Color.new hex_argb: 0xffff0000 }
63 |
64 | it { should be_true }
65 | end
66 |
67 | context 'with a different color' do
68 | let(:color2) { Exo::Color.new hex_argb: 0xffffff00 }
69 |
70 | it { should be_false }
71 | end
72 | end
73 |
74 | end
75 |
76 | end
77 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/controllers/admin/users_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Admin::UsersController do
4 | describe 'GET index' do
5 | subject(:do_request) { get :index }
6 |
7 | it_behaves_like 'an admin action'
8 | end
9 |
10 | describe 'GET show' do
11 | let(:target_user) { create :user }
12 | subject(:do_request) { get :show, id: target_user }
13 |
14 | it_behaves_like 'an admin action'
15 | end
16 |
17 | describe 'GET new' do
18 | subject(:do_request) { get :new }
19 |
20 | it_behaves_like 'an admin action'
21 | end
22 |
23 | describe 'GET edit' do
24 | let(:target_user) { create :user }
25 | subject(:do_request) { get :edit, id: target_user }
26 |
27 | it_behaves_like 'an admin action'
28 | end
29 |
30 | describe 'POST create' do
31 | let(:params) do
32 | {
33 | email: Faker::Internet.email,
34 | password: 'foobar02',
35 | password_confirmation: 'foobar02',
36 | first_name: Faker::Name.first_name,
37 | last_name: Faker::Name.last_name
38 | }
39 | end
40 |
41 | subject(:do_request) { post :create, user: params }
42 |
43 | it_behaves_like 'an admin action'
44 |
45 | when_logged_in as_admin do
46 | it 'should have created a user' do
47 | expect { do_request }.to change { User.count }.by(1)
48 | end
49 | end
50 | end
51 |
52 | describe 'PUT update' do
53 | let(:target_user) { create :user }
54 | let(:params) do
55 | {
56 | first_name: Faker::Name.first_name,
57 | last_name: Faker::Name.last_name,
58 | }
59 | end
60 | subject(:do_request) { put :create, id: target_user, user: params }
61 |
62 | it_behaves_like 'an admin action'
63 | end
64 |
65 | describe 'DELETE destroy' do
66 | let(:target_user) { create :user }
67 | subject(:do_request) { delete :destroy, id: target_user }
68 |
69 | it_behaves_like 'an admin action'
70 |
71 | when_logged_in as_admin do
72 | it 'should have destroyed the user' do
73 | target_user
74 | expect { do_request }.to change { User.count }.by(-1)
75 | end
76 | end
77 | end
78 | end
79 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/planets/planets.css.sass:
--------------------------------------------------------------------------------
1 | @import ../application
2 |
3 | #stage
4 | padding: $fib-9
5 | background: black
6 | margin-left: -$fib-7
7 | margin-right: -$fib-7
8 | height: 400px
9 | +relative
10 |
11 | .planet
12 | margin-top: -128px
13 | margin-left: -128px
14 |
15 | // +transform(scale(0.5,0.5))
16 | +absolute(50%, 50%)
17 |
18 | +before
19 | +absolute
20 | +box(256px)
21 | +border-radius(50%)
22 | +box-shadow(0 0 20px #5baebb, 0 0 60px #30778c, 0 0 100px darkblue)
23 |
24 | .body
25 | z-index: 1
26 |
27 | +relative
28 | +box(256px)
29 | +border-radius(50%)
30 | +box-shadow(inset 0 0 8px 2px #3ec6ed, inset 0 0 40px 5px #54afbd, inset -30px -30px 30px rgba(0, 0, 60, 0.8))
31 |
32 | .cloud
33 | margin: -10px
34 |
35 | +border-radius(50%)
36 | +box(20px)
37 | +absolute
38 |
39 | .shadow
40 | background: rgba(41, 69, 94, 0.5)
41 | margin: -12px
42 |
43 | +absolute
44 | +box(24px)
45 | +border-radius(50%)
46 | +box-shadow(0 0 10px 5px rgba(41, 69, 94, 0.5))
47 |
48 | .glass-ball
49 | width: 50px
50 | height: 50px
51 | border: 0px solid rgba(255,255,255,0.5)
52 | border-top-width: 2px
53 | border-bottom-width: 2px
54 | padding: 14px 0
55 | text-align: center
56 | +box-sizing(border-box)
57 | +background(radial-gradient(circle 50px 60px at top center , rgba(255,255,255,0.2) 40%, rgba(0,0,0,0.2) 70%, rgba(255,255,255,0) 80%) repeat scroll 0 0 transparent)
58 | +border-radius(50%)
59 |
60 | &:before
61 | content: ''
62 | width: 20px
63 | height: 20px
64 | display: block
65 | position: absolute
66 | z-index: 1
67 | left: 16px
68 | top: 14px
69 | +border-radius(50%)
70 | +background(radial-gradient(circle 10px 10px at center center, rgba(255,255,255,0.6) 30%, rgba(255,255,255,0) 100%) repeat scroll 0 0 transparent)
71 |
72 | &:after
73 | content: ''
74 | display: block
75 | width: 60px
76 | height: 30px
77 | position: absolute
78 | margin-left: -5px
79 | margin-top: 3px
80 | +border-radius(50%)
81 | +background(radial-gradient(circle 30px 6px at center center, rgba(0,0,0,0.2) 00%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.22) 70%, rgba(0,0,0,0) 100%) repeat scroll 0 0 transparent)
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/test/exoplanets/Guardfile:
--------------------------------------------------------------------------------
1 | guard 'livereload' do
2 | watch(%r{app/views/.+\.(erb|haml|slim)$})
3 | watch(%r{app/helpers/.+\.rb})
4 | watch(%r{public/.+\.(css|js|html)})
5 | watch(%r{config/locales/.+\.yml})
6 | # Rails Assets Pipeline
7 | watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
8 | end
9 |
10 | guard :rspec, drb: true, all_after_pass: false do
11 | watch(%r{^spec/.+_spec\.rb$})
12 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
13 | watch('spec/spec_helper.rb') { "spec" }
14 |
15 | # Rails example
16 | watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
17 | watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
18 | watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
19 | [
20 | "spec/routing/#{m[1]}_routing_spec.rb",
21 | "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb",
22 | "spec/acceptance/#{m[1]}_spec.rb"
23 | ]
24 | end
25 | watch(%r{^app/models/(.+)\.rb$}) do |m|
26 | [
27 | "spec/models/factories/#{m[1]}s_factory_spec.rb",
28 | "spec/acceptance/#{m[1]}_spec.rb"
29 | ]
30 | end
31 |
32 | watch(%r{^spec/factories/(.+)\.rb$}) do |m|
33 | "spec/models/factories/#{m[1]}_factory_spec.rb"
34 | end
35 |
36 | watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
37 | watch('config/routes.rb'){ "spec/routing" }
38 | watch('app/controllers/application_controller.rb') { "spec/controllers" }
39 |
40 | # Capybara features specs
41 | watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
42 |
43 | # Turnip features and steps
44 | watch(%r{^spec/acceptance/(.+)\.feature$})
45 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
46 | end
47 |
48 | guard 'spork', cucumber: false, :rspec_env => { 'RAILS_ENV' => 'test' } do
49 | watch('config/application.rb')
50 | watch('config/environment.rb')
51 | watch('config/environments/test.rb')
52 | watch(%r{^config/initializers/.+\.rb$})
53 | watch('Gemfile.lock')
54 | watch('spec/spec_helper.rb') { :rspec }
55 | watch('test/test_helper.rb') { :test_unit }
56 | watch(%r{features/support/}) { :cucumber }
57 | end
58 |
59 | guard 'bundler' do
60 | watch('Gemfile')
61 | # Uncomment next line if Gemfile contain `gemspec' command
62 | # watch(/^.+\.gemspec/)
63 | end
64 |
65 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/FresnelShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Based on Nvidia Cg tutorial
5 | */
6 |
7 | THREE.FresnelShader = {
8 |
9 | uniforms: {
10 |
11 | "mRefractionRatio": { type: "f", value: 1.02 },
12 | "mFresnelBias": { type: "f", value: 0.1 },
13 | "mFresnelPower": { type: "f", value: 2.0 },
14 | "mFresnelScale": { type: "f", value: 1.0 },
15 | "tCube": { type: "t", value: null }
16 |
17 | },
18 |
19 | vertexShader: [
20 |
21 | "uniform float mRefractionRatio;",
22 | "uniform float mFresnelBias;",
23 | "uniform float mFresnelScale;",
24 | "uniform float mFresnelPower;",
25 |
26 | "varying vec3 vReflect;",
27 | "varying vec3 vRefract[3];",
28 | "varying float vReflectionFactor;",
29 |
30 | "void main() {",
31 |
32 | "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
33 | "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
34 |
35 | "vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );",
36 |
37 | "vec3 I = worldPosition.xyz - cameraPosition;",
38 |
39 | "vReflect = reflect( I, worldNormal );",
40 | "vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );",
41 | "vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );",
42 | "vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );",
43 | "vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );",
44 |
45 | "gl_Position = projectionMatrix * mvPosition;",
46 |
47 | "}"
48 |
49 | ].join("\n"),
50 |
51 | fragmentShader: [
52 |
53 | "uniform samplerCube tCube;",
54 |
55 | "varying vec3 vReflect;",
56 | "varying vec3 vRefract[3];",
57 | "varying float vReflectionFactor;",
58 |
59 | "void main() {",
60 |
61 | "vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
62 | "vec4 refractedColor = vec4( 1.0 );",
63 |
64 | "refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
65 | "refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
66 | "refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
67 |
68 | "gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
69 |
70 | "}"
71 |
72 | ].join("\n")
73 |
74 | };
75 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_collections.sass:
--------------------------------------------------------------------------------
1 | .collection
2 | width: 100%
3 | border-top: 4px solid $pad-border-color
4 |
5 | +border-radius($pad-border-radius-x, $pad-border-radius-y)
6 | +box-shadow(inset $pad-shadow)
7 |
8 | table
9 | width: 100%
10 | overflow: hidden
11 |
12 | thead
13 | +box-shadow($pad-shadow, inset $pad-shadow)
14 | +border-radius-top($pad-border-radius-x, $pad-border-radius-y)
15 |
16 | th
17 | color: $color-grey-6
18 | background: $color-blue-medium
19 | border-bottom: 3px solid $color-blue-dark
20 | font-weight: 300
21 |
22 | +font-block(1.4, 2)
23 | +text-shadow($pad-shadow)
24 |
25 | &:first-child
26 | +border-top-left-radius($pad-border-radius-x $pad-border-radius-y)
27 |
28 | &:last-child
29 | +border-top-right-radius($pad-border-radius-x $pad-border-radius-y)
30 |
31 |
32 | th, td
33 | padding: $fib-6
34 |
35 | &:first-child
36 | padding-right: 0
37 | text-align: center
38 |
39 | &:nth-child(2)
40 | text-align: left
41 | vertical-align: top
42 |
43 | &:last-child
44 | padding-left: 0
45 | text-align: right
46 | vertical-align: top
47 |
48 | tr + tr
49 | border-top: 1px solid $color-grey-4
50 |
51 | .name
52 | vertical-align: middle
53 |
54 | border-bottom: 1px solid $color-grey-3
55 |
56 | +inline-box
57 | +font-block(2, 2.4)
58 |
59 |
60 | .time
61 | font-weight: 500
62 | color: $color-grey-6
63 |
64 | +inline-box
65 | +font-block(0.8, 1.3)
66 |
67 | & + .time
68 | +before('| ')
69 |
70 | .actions
71 | letter-spacing: -0.31em
72 | white-space: nowrap
73 |
74 | +inline-box
75 | +box-shadow($pad-shadow)
76 | +border-radius($pad-border-radius-x, $pad-border-radius-y)
77 | +button-container
78 |
79 | +polymorphic-button('& > a', 1px 3px 5px)
80 | +colorized-button
81 | +button-group
82 | +box-shadow(none)
83 |
84 | .id
85 | border-bottom: 1px solid $color-blue-medium
86 | background: $color-blue-light
87 | padding: $fib-3 $fib-5
88 | font-weight: 500
89 | color: $pad-color
90 |
91 | +inline-box
92 | +font-block(0.8,1)
93 | +border-radius($fib-7)
94 | +box-shadow(0 1px 3px rgba(0,0,0,0.3))
95 | +text-shadow(0 0 3px rgba(0,0,0,0.7))
96 |
97 | .item
98 | +relative
99 |
100 |
101 |
--------------------------------------------------------------------------------
/test/exoplanets/config/locales/en.yml:
--------------------------------------------------------------------------------
1 |
2 | en:
3 | no_data: 'No entries yet, click on New to start creating one'
4 |
5 | actions: &actions
6 | sign_in: Sign in
7 | sign_out: Sign out
8 | sign_up: Sign up
9 |
10 | create: New
11 | destroy: Remove
12 | edit: Edit
13 | update: Save
14 | cancel: Cancel
15 | submit: Submit
16 |
17 | time: &time
18 | formats:
19 | default: '%Y-%m-%d %H:%M:%S'
20 | short: '%H:%M'
21 |
22 | date: &date
23 | formats:
24 | default: '%Y-%m-%d'
25 |
26 | timestamps: ×tamps
27 | updated_at: Last update
28 | created_at: Created at
29 |
30 | models: &models
31 | users: Users
32 | planets: Planets
33 | styles: Styles
34 |
35 | links: &links
36 | home: Home
37 | <<: *models
38 |
39 | session:
40 | anonymous: Anonymous
41 | message: Sign in with your account or sign up.
42 |
43 | admin:
44 | no_data: 'No entries yet, click on New to start creating one'
45 |
46 | links:
47 | home: Admin
48 | <<: *models
49 |
50 | actions:
51 | <<: *actions
52 |
53 | tables:
54 | columns:
55 | id: '#'
56 | last_update: Last Update
57 | actions: Actions
58 |
59 | breadcrumbs:
60 | home: Home
61 |
62 | simple_form:
63 | yes: 'Yes'
64 | no: 'No'
65 | required:
66 | html: ''
67 | error_notification:
68 | default_message: "Please review the problems below:"
69 |
70 | placeholders:
71 | types: &types
72 | none: ''
73 | string: ''
74 | boolean: false
75 | email: email@company.com
76 | number: 0
77 | file: Browse for file
78 |
79 | identity: &identity
80 | first_name: John
81 | last_name: Doe
82 | email: john.doe@company.com
83 | password: password
84 | password_confirmation: password
85 |
86 | <<: *identity
87 | <<: *types
88 |
89 | user:
90 | <<: *identity
91 |
92 | session:
93 | <<: *identity
94 |
95 | registration:
96 | <<: *identity
97 |
98 | labels:
99 | user:
100 | <<: *timestamps
101 |
102 | password_confirmation: Confirmation
103 |
104 | views:
105 | pagination:
106 | previous: Previous
107 | first: First
108 | last: Last
109 | next: Next
110 | truncate: "..."
111 |
112 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/ConvolutionShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Convolution shader
5 | * ported from o3d sample to WebGL / GLSL
6 | * http://o3d.googlecode.com/svn/trunk/samples/convolution.html
7 | */
8 |
9 | THREE.ConvolutionShader = {
10 |
11 | defines: {
12 |
13 | "KERNEL_SIZE_FLOAT": "25.0",
14 | "KERNEL_SIZE_INT": "25",
15 |
16 | },
17 |
18 | uniforms: {
19 |
20 | "tDiffuse": { type: "t", value: null },
21 | "uImageIncrement": { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
22 | "cKernel": { type: "fv1", value: [] }
23 |
24 | },
25 |
26 | vertexShader: [
27 |
28 | "uniform vec2 uImageIncrement;",
29 |
30 | "varying vec2 vUv;",
31 |
32 | "void main() {",
33 |
34 | "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;",
35 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
36 |
37 | "}"
38 |
39 | ].join("\n"),
40 |
41 | fragmentShader: [
42 |
43 | "uniform float cKernel[ KERNEL_SIZE_INT ];",
44 |
45 | "uniform sampler2D tDiffuse;",
46 | "uniform vec2 uImageIncrement;",
47 |
48 | "varying vec2 vUv;",
49 |
50 | "void main() {",
51 |
52 | "vec2 imageCoord = vUv;",
53 | "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
54 |
55 | "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {",
56 |
57 | "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];",
58 | "imageCoord += uImageIncrement;",
59 |
60 | "}",
61 |
62 | "gl_FragColor = sum;",
63 |
64 | "}"
65 |
66 |
67 | ].join("\n"),
68 |
69 | buildKernel: function ( sigma ) {
70 |
71 | // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.
72 |
73 | function gauss( x, sigma ) {
74 |
75 | return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );
76 |
77 | }
78 |
79 | var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1;
80 |
81 | if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize;
82 | halfWidth = ( kernelSize - 1 ) * 0.5;
83 |
84 | values = new Array( kernelSize );
85 | sum = 0.0;
86 | for ( i = 0; i < kernelSize; ++i ) {
87 |
88 | values[ i ] = gauss( i - halfWidth, sigma );
89 | sum += values[ i ];
90 |
91 | }
92 |
93 | // normalize the kernel
94 |
95 | for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
96 |
97 | return values;
98 |
99 | }
100 |
101 | };
102 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/_styles.css.sass:
--------------------------------------------------------------------------------
1 |
2 | html, body
3 | +box(100%, 100%)
4 | background: $color-blue-very-dark
5 |
6 | // body
7 | // background: url(/images/0.png)
8 |
9 | *
10 | +box-sizing(border-box)
11 |
12 |
13 | a
14 | color: $color-blue-medium
15 | border-bottom: 1px solid transparent
16 |
17 | +transition(color 0.3s, border-color 0.3s)
18 |
19 | &:hover
20 | border-bottom: 1px solid $color-blue-light
21 |
22 | hr
23 | margin: 13px 0
24 | height: 5px
25 | border: 0px solid $pad-border-color
26 | background: $color-grey-9
27 |
28 | +inner-pad(3px)
29 | +border-radius(5px)
30 |
31 | form
32 | border: 0px solid $pad-border-color
33 | background: $pad-color
34 | margin-bottom: $fib-6
35 |
36 | +inner-pad(2px)
37 | +border-radius(5px)
38 | +box-shadow(inset 0px 0px 3px lighten($pad-border-color, 5))
39 |
40 | fieldset
41 | border: none
42 | margin: 0
43 | padding: 13px 13px
44 |
45 | &.actions
46 | background: $color-blue-medium
47 | text-align: right
48 |
49 | +char-collapse
50 | +border-radius-bottom(5px)
51 |
52 | & > input
53 | height: 34px
54 |
55 | &:hover
56 | height: 36px
57 |
58 | &:active
59 | height: 32px
60 |
61 | & > *
62 | +box-shadow(none)
63 | +button-group
64 |
65 | .row
66 | clear: left
67 | +char-collapse
68 |
69 | .gutter
70 | margin: 0 auto
71 | width: 860px
72 |
73 | & > *
74 | margin-top: 13px
75 | margin-bottom: 13px
76 |
77 | @media (max-width: 859px)
78 | .gutter
79 | width: 100%
80 | margin: 0
81 |
82 | @for $i from 1 through $colors-count
83 | $name: nth($colors-name, $i)
84 | $color: nth($colors-light, $i)
85 |
86 | span.#{$name}
87 | color: $color
88 |
89 | #before-header
90 | #before-header-left
91 | #before-header-right
92 |
93 | #header
94 |
95 | #header-left
96 | h1
97 | color: $color-grey-5
98 | text-transform: lowercase
99 | margin: 0
100 | margin-bottom: $fib-6
101 |
102 | font-weight: normal
103 | +font-block(3, 1.4)
104 |
105 | #header-right
106 | text-align: right
107 |
108 | #before-content
109 |
110 | #content-header
111 | text-align: right
112 | margin-bottom: 13px
113 |
114 | #content
115 | background: $pad-color
116 | border: 0px solid $pad-border-color
117 | padding: 21px
118 |
119 | +pad(4px)
120 | +relative
121 | +border-radius(6px, 8px)
122 |
123 | .pure-g
124 | margin: $fib-6 (-$fib-4)
125 |
126 | [class*='pure-u-']
127 | padding: 0 $fib-4
128 |
129 |
130 |
131 | #after-content
132 |
133 | #footer
134 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/javascripts/three_boot.js.coffee:
--------------------------------------------------------------------------------
1 | #= require three
2 | #= require_tree ../../../vendor/assets/javascripts/shaders
3 | #= require_tree ../../../vendor/assets/javascripts/postprocessing
4 |
5 | $ ->
6 | container = document.getElementById('stage')
7 |
8 | w = container.offsetWidth or window.innerWidth
9 | h = container.offsetHeight or window.innerHeight
10 |
11 | w = 640
12 | h = 380
13 |
14 | distance = 1000
15 |
16 | camera = new THREE.PerspectiveCamera(30, w / h, 1, 10000)
17 | camera.position.z = distance
18 |
19 | scene = new THREE.Scene()
20 |
21 | geometry = new THREE.SphereGeometry(200, 40, 30)
22 |
23 | uniforms = texture: { type: 't', value: THREE.ImageUtils.loadTexture('/images/0.png')}
24 |
25 | shader =
26 | vertexShader: '''
27 | varying vec3 vNormal;
28 | varying vec2 vUv;
29 |
30 | void main() {
31 | gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
32 | vNormal = normalize( normalMatrix * normal );
33 | vUv = uv;
34 | }
35 | '''
36 | fragmentShader: '''
37 | uniform sampler2D texture;
38 | varying vec3 vNormal;
39 | varying vec2 vUv;
40 |
41 | void main() {
42 |
43 | vec3 diffuse = texture2D( texture, vUv ).xyz;
44 | float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );
45 | vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );
46 | gl_FragColor = vec4( diffuse + atmosphere, 1.0 );
47 | }
48 | '''
49 |
50 | material = new THREE.ShaderMaterial({
51 | uniforms: uniforms
52 | vertexShader: shader.vertexShader
53 | fragmentShader: shader.fragmentShader
54 | })
55 |
56 | mesh = new THREE.Mesh(geometry, material)
57 | # mesh.matrixAutoUpdate = false
58 | scene.add(mesh)
59 |
60 | renderer = new THREE.WebGLRenderer({antialias: true})
61 | renderer.autoClear = true
62 | renderer.setClearColor(0x000000, 0.0)
63 | renderer.setSize(w, h)
64 |
65 | composer = new THREE.EffectComposer(renderer)
66 | renderPass = new THREE.RenderPass(scene, camera)
67 | # renderPass.renderToScreen = true
68 | composer.addPass(renderPass)
69 |
70 | bloom = new THREE.BloomPass()
71 | bloom.renderToScreen = true
72 | composer.addPass(bloom)
73 |
74 | # renderer.domElement.style.position = 'absolute'
75 |
76 | container.appendChild(composer.renderTarget.domElement)
77 | # container.appendChild(renderer.domElement)
78 |
79 | playing = true
80 |
81 | animate = ->
82 | # renderer.clear()
83 | # renderer.render(scene, camera)
84 | composer.render(0.1)
85 | mesh.rotation.y += 0.002
86 |
87 | setTimeout (-> requestAnimationFrame animate if playing), 0
88 |
89 | animate()
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/common/_mixins.sass:
--------------------------------------------------------------------------------
1 | @import mixins/geometry
2 | @import mixins/responsive
3 |
4 | =vendor-prefix($name, $argument)
5 | #{$name}: $argument
6 | -webkit-#{$name}: $argument
7 | -ms-#{$name}: $argument
8 | -moz-#{$name}: $argument
9 | -o-#{$name}: $argument
10 |
11 | =text-ellipsis()
12 | overflow: hidden
13 | white-space: nowrap
14 | +vendor-prefix(text-overflow, ellipsis)
15 |
16 | =placeholder()
17 | &::-webkit-input-placeholder
18 | @content
19 |
20 | &:-moz-placeholder
21 | @content
22 |
23 | &::-moz-placeholder
24 | @content
25 |
26 | &:-ms-input-placeholder
27 | @content
28 |
29 | &::placeholder
30 | @content
31 |
32 | =range-thumb()
33 | &::-webkit-slider-thumb
34 | -webkit-appearance: none
35 | @content
36 |
37 | &::-moz-range-thumb
38 | @content
39 |
40 | & .thumb
41 | @content
42 |
43 | =range-track()
44 | & .track
45 | @content
46 |
47 | +webkit-only
48 | &
49 | -webkit-appearance: none
50 | @content
51 |
52 | &::-moz-range-track
53 | @content
54 |
55 | =char-collapse()
56 | letter-spacing: -0.31em
57 | white-space: nowrap
58 |
59 | =reset-char-collapse()
60 | letter-spacing: normal
61 | white-space: normal
62 |
63 | =rem($property, $value)
64 | #{$property}: $value * $base-font-size
65 | #{$property}: #{$value}rem
66 |
67 | =font-block($size, $line)
68 | +rem(font-size, $size)
69 | +rem(line-height, $line)
70 |
71 | =relative($top: 0, $left: 0)
72 | position: relative
73 | top: $top
74 | left: $left
75 |
76 | =absolute($top: 0, $left: 0)
77 | position: absolute
78 | top: $top
79 | left: $left
80 |
81 | =fixed($top: 0, $left: 0)
82 | position: fixed
83 | top: $top
84 | left: $left
85 |
86 | =box($width: auto, $height: $width)
87 | display: block
88 | width: $width
89 | height: $height
90 |
91 | =inline-box($width: auto, $height: $width)
92 | display: inline-block
93 | width: $width
94 | height: $height
95 |
96 | =inline-list($inlined: true)
97 | margin: 0
98 | padding: 0
99 |
100 | @if $inlined
101 | display: inline-block
102 |
103 | li
104 | margin: 0
105 | padding: 0
106 | list-style: none
107 | float: left
108 |
109 | =before($content: '')
110 | &:before
111 | content: $content
112 |
113 | @content
114 |
115 | =after($content: '')
116 | &:after
117 | content: $content
118 |
119 | @content
120 |
121 | =before-and-after($content: '')
122 | +before($content)
123 | @content
124 |
125 | +after($content)
126 | @content
127 |
128 | =clearfix($height: 0)
129 | &:after
130 | content: "."
131 | display: block
132 | height: $height
133 | clear: both
134 | visibility: hidden
135 |
--------------------------------------------------------------------------------
/test/exoplanets/spec/support/shared_routing.rb:
--------------------------------------------------------------------------------
1 | ALL_CRUD_METHODS = [
2 | :index,
3 | :create,
4 | :new,
5 | :show,
6 | :edit,
7 | :update,
8 | :destroy
9 | ]
10 |
11 | shared_examples 'routes resources' do |options|
12 | resource_name = options[:model]
13 | resource_path = options[:path]
14 | resource_controller = options[:controller] || resource_path
15 | resource_methods = options[:methods] || ALL_CRUD_METHODS
16 | resource_scope = options[:scope] || {}
17 |
18 | if resource_methods.include? :index
19 | it "routes GET /#{resource_path} to #{resource_controller}#index" do
20 | expect(get: "/#{resource_path}").to route_to({
21 | controller: resource_controller,
22 | action: 'index',
23 | }.merge resource_scope)
24 | end
25 | end
26 |
27 | if resource_methods.include? :show
28 | it "routes GET /#{resource_path}/:id to #{resource_controller}#show" do
29 | expect(get: "/#{resource_path}/42").to route_to({
30 | controller: "#{resource_controller}",
31 | action: 'show',
32 | id: '42'
33 | }.merge resource_scope)
34 | end
35 | end
36 |
37 | if resource_methods.include? :edit
38 | it "routes GET /#{resource_path}/:id/edit to #{resource_controller}#edit" do
39 | expect(get: "/#{resource_path}/42/edit").to route_to({
40 | controller: "#{resource_controller}",
41 | action: "edit",
42 | id: "42"
43 | }.merge resource_scope)
44 | end
45 | end
46 |
47 | if resource_methods.include? :new
48 | it "routes GET /#{resource_path}/new to #{resource_controller}#new" do
49 | expect(get: "/#{resource_path}/new").to route_to({
50 | controller: "#{resource_controller}",
51 | action: "new",
52 | }.merge resource_scope)
53 | end
54 | end
55 |
56 | if resource_methods.include? :update
57 | it "routes PUT /#{resource_path}/:id/update to #{resource_controller}#update" do
58 | expect(put: "/#{resource_path}/42").to route_to({
59 | controller: "#{resource_controller}",
60 | action: "update",
61 | id: "42"
62 | }.merge resource_scope)
63 | end
64 | end
65 |
66 | if resource_methods.include? :destroy
67 | it "routes DELETE /#{resource_path}/:id to #{resource_controller}#destroy" do
68 | expect(delete: "/#{resource_path}/42").to route_to({
69 | controller: "#{resource_controller}",
70 | action: "destroy",
71 | id: "42"
72 | }.merge resource_scope)
73 | end
74 | end
75 |
76 | if resource_methods.include? :create
77 | it "routes POST /#{resource_path} to #{resource_controller}#create" do
78 | expect(post: "/#{resource_path}").to route_to({
79 | controller: "#{resource_controller}",
80 | action: "create",
81 | }.merge resource_scope)
82 | end
83 | end
84 | end
85 |
86 |
--------------------------------------------------------------------------------
/test/exoplanets/app/assets/stylesheets/partials/_kaminari.sass:
--------------------------------------------------------------------------------
1 |
2 | .pagination
3 | position: relative
4 | display: inline-block
5 |
6 |
7 | .buttons
8 | display: block
9 | height: 18px
10 | padding-right: 4px
11 |
12 | +char-collapse
13 | +box-shadow($pad-shadow)
14 | +border-radius(3px, 4px)
15 |
16 | .buttons > *
17 | +button
18 | +box-shadow(none)
19 | +colorized-button
20 | +button-group
21 | +very-small-button
22 |
23 | &:not(.current)
24 | padding: 0
25 |
26 | a
27 | display: block
28 | margin: 0
29 |
30 | @extend %button-padding-very-small
31 | @extend %button-font-very-small
32 |
33 | &:not(.page)
34 | +colorize-button($color-blue-light, $color-blue-medium)
35 |
36 |
37 | &.current
38 | padding-bottom: $fib-2 + 1
39 | pointer-events: none
40 | font-weight: bold
41 |
42 | +text-shadow($pad-shadow)
43 | +colorize-button($color-red-light, $color-red-medium)
44 | color: $pad-color
45 |
46 |
47 | a
48 | color: $pad-text-color
49 |
50 | &:hover
51 | border-color: transparent
52 |
53 | // top pagination
54 | #content-header + .pagination
55 | background: $color-blue-medium
56 | padding: $fib-5 $fib-5 $fib-6
57 | margin-bottom: -$fib-6
58 | border-top: 4px solid $pad-border-color
59 |
60 | +border-top-left-radius($pad-border-radius-x $pad-border-radius-y)
61 | +border-top-right-radius($pad-border-radius-x $pad-border-radius-y)
62 | +box-shadow(inset 5px 5px 4px -5px $pad-shadow-color)
63 |
64 | +before
65 | background: $color-blue-medium
66 | bottom: 0
67 |
68 | +absolute(inherit, 100%)
69 | +box(10px, 30px)
70 |
71 | +after
72 | background: $pad-color
73 | bottom: 7px
74 | border-bottom: 4px solid $pad-border-color
75 |
76 | +border-bottom-left-radius($pad-border-radius-x $pad-border-radius-y)
77 | +absolute(inherit, 100%)
78 | +box(20px)
79 | +box-shadow(-4px 6px 5px -4px $pad-shadow-color)
80 |
81 | // bottom pagination
82 | .collection + .pagination
83 | background: $pad-color
84 | padding: $fib-6 $fib-5 $fib-5
85 | margin-top: -$fib-5
86 |
87 | +border-bottom-left-radius($pad-border-radius-x $pad-border-radius-y)
88 | +border-bottom-right-radius($pad-border-radius-x $pad-border-radius-y)
89 | +box-shadow(inset 3px -2px 4px -3px $pad-shadow-color)
90 |
91 | +before
92 | background: $pad-color
93 |
94 | +absolute(0, 100%)
95 | +box(10px, 30px)
96 |
97 | +after
98 | background: $pad-color
99 |
100 | +border-top-left-radius($pad-border-radius-x $pad-border-radius-y)
101 | +absolute(8px, 100%)
102 | +box(20px, 33px)
103 | +box-shadow(-2px -2px 5px -4px $pad-shadow-color)
104 |
--------------------------------------------------------------------------------
/test/exoplanets/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20130930215104) do
15 |
16 | # These are extensions that must be enabled in order to support this database
17 | enable_extension "plpgsql"
18 | enable_extension "hstore"
19 |
20 | create_table "planets", force: true do |t|
21 | t.string "name"
22 | t.integer "seed"
23 | t.hstore "properties"
24 | t.datetime "created_at"
25 | t.datetime "updated_at"
26 | t.string "surface_image"
27 | end
28 |
29 | create_table "roles", force: true do |t|
30 | t.string "name"
31 | t.integer "resource_id"
32 | t.string "resource_type"
33 | t.datetime "created_at"
34 | t.datetime "updated_at"
35 | end
36 |
37 | add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
38 | add_index "roles", ["name"], name: "index_roles_on_name", using: :btree
39 |
40 | create_table "users", force: true do |t|
41 | t.string "email", default: "", null: false
42 | t.string "encrypted_password", default: "", null: false
43 | t.string "reset_password_token"
44 | t.datetime "reset_password_sent_at"
45 | t.datetime "remember_created_at"
46 | t.integer "sign_in_count", default: 0
47 | t.datetime "current_sign_in_at"
48 | t.datetime "last_sign_in_at"
49 | t.string "current_sign_in_ip"
50 | t.string "last_sign_in_ip"
51 | t.datetime "created_at"
52 | t.datetime "updated_at"
53 | t.string "first_name"
54 | t.string "last_name"
55 | t.string "avatar"
56 | t.string "avatar_meta"
57 | end
58 |
59 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
60 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
61 |
62 | create_table "users_roles", id: false, force: true do |t|
63 | t.integer "user_id"
64 | t.integer "role_id"
65 | end
66 |
67 | add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree
68 |
69 | end
70 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/FocusShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Focus shader
5 | * based on PaintEffect postprocess from ro.me
6 | * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
7 | */
8 |
9 | THREE.FocusShader = {
10 |
11 | uniforms : {
12 |
13 | "tDiffuse": { type: "t", value: null },
14 | "screenWidth": { type: "f", value: 1024 },
15 | "screenHeight": { type: "f", value: 1024 },
16 | "sampleDistance": { type: "f", value: 0.94 },
17 | "waveFactor": { type: "f", value: 0.00125 }
18 |
19 | },
20 |
21 | vertexShader: [
22 |
23 | "varying vec2 vUv;",
24 |
25 | "void main() {",
26 |
27 | "vUv = uv;",
28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
29 |
30 | "}"
31 |
32 | ].join("\n"),
33 |
34 | fragmentShader: [
35 |
36 | "uniform float screenWidth;",
37 | "uniform float screenHeight;",
38 | "uniform float sampleDistance;",
39 | "uniform float waveFactor;",
40 |
41 | "uniform sampler2D tDiffuse;",
42 |
43 | "varying vec2 vUv;",
44 |
45 | "void main() {",
46 |
47 | "vec4 color, org, tmp, add;",
48 | "float sample_dist, f;",
49 | "vec2 vin;",
50 | "vec2 uv = vUv;",
51 |
52 | "add = color = org = texture2D( tDiffuse, uv );",
53 |
54 | "vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
55 | "sample_dist = dot( vin, vin ) * 2.0;",
56 |
57 | "f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
58 |
59 | "vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
60 |
61 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
62 | "if( tmp.b < color.b ) color = tmp;",
63 |
64 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
65 | "if( tmp.b < color.b ) color = tmp;",
66 |
67 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
68 | "if( tmp.b < color.b ) color = tmp;",
69 |
70 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
71 | "if( tmp.b < color.b ) color = tmp;",
72 |
73 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
74 | "if( tmp.b < color.b ) color = tmp;",
75 |
76 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
77 | "if( tmp.b < color.b ) color = tmp;",
78 |
79 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
80 | "if( tmp.b < color.b ) color = tmp;",
81 |
82 | "color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
83 | "color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
84 |
85 | "gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
86 |
87 | "}"
88 |
89 |
90 | ].join("\n")
91 | };
92 |
--------------------------------------------------------------------------------
/test/exoplanets/README.textile:
--------------------------------------------------------------------------------
1 | h1. Exoplanets
2 |
3 | This application was generated with the "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer gem provided by the "RailsApps Project":http://railsapps.github.io/.
4 |
5 | h2. Diagnostics
6 |
7 | This application was built with recipes that are NOT known to work together.
8 |
9 | This application was built with preferences that are NOT known to work together.
10 |
11 | If the application doesn't work as expected, please "report an issue":https://github.com/RailsApps/rails_apps_composer/issues and include these diagnostics:
12 |
13 | We'd also like to know if you've found combinations of recipes or preferences that do work together.
14 |
15 | Recipes:
16 | ["apps4", "controllers", "core", "email", "extras", "frontend", "gems", "git", "init", "models", "prelaunch", "railsapps", "readme", "routes", "saas", "setup", "testing", "views"]
17 |
18 | Preferences:
19 | {:git=>true, :apps4=>"none", :dev_webserver=>"unicorn", :prod_webserver=>"unicorn", :database=>"postgresql", :templates=>"haml", :unit_test=>"rspec", :integration=>"rspec-capybara", :continuous_testing=>"guard", :fixtures=>"factory_girl", :frontend=>"normalize", :email=>"none", :authentication=>"devise", :devise_modules=>"default", :authorization=>"cancan", :form_builder=>"simple_form", :starter_app=>"admin_app", :rvmrc=>false, :quiet_assets=>true, :local_env_file=>true, :better_errors=>true, :ban_spiders=>true, :jsruntime=>false}
20 |
21 | h2. Ruby on Rails
22 |
23 | This application requires:
24 |
25 | * Ruby version 2.0.0
26 | * Rails version 4.0.0
27 |
28 | Learn more about "Installing Rails":http://railsapps.github.io/installing-rails.html.
29 |
30 | h2. Database
31 |
32 | This application uses PostgreSQL with ActiveRecord.
33 |
34 | h2. Development
35 |
36 | * Template Engine: Haml
37 | * Testing Framework: RSpec and Factory Girl
38 | * Front-end Framework: Normalized CSS
39 | * Form Builder: SimpleForm
40 | * Authentication: Devise
41 | * Authorization: CanCan
42 |
43 |
44 |
45 |
46 |
47 | h2. Getting Started
48 |
49 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
50 |
51 | h2. Documentation and Support
52 |
53 | This is the only documentation.
54 |
55 | h4. Issues
56 |
57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
58 |
59 | h2. Similar Projects
60 |
61 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
62 |
63 | h2. Contributing
64 |
65 | If you make improvements to this application, please share with others.
66 |
67 | * Fork the project on GitHub.
68 | * Make your feature addition or bug fix.
69 | * Commit with Git.
70 | * Send the author a pull request.
71 |
72 | If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work.
73 |
74 | h2. Credits
75 |
76 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
77 |
78 | h2. License
79 |
80 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
81 |
--------------------------------------------------------------------------------
/test/exoplanets/app/helpers/simple_form_helper.rb:
--------------------------------------------------------------------------------
1 | module SimpleFormHelper
2 | SKIPPED_COLUMNS = [
3 | :created_at, :updated_at, :created_on, :updated_on,
4 | :lock_version, :version,
5 |
6 | # Devise
7 | :encrypted_password, :reset_password_token, :reset_password_sent_at,
8 | :last_sign_in_at, :last_sign_in_ip,
9 | :current_sign_in_at, :current_sign_in_ip,
10 | :remember_created_at,
11 |
12 | # CarrierWave Meta
13 | :avatar_meta, :image_meta,
14 | ]
15 |
16 | def default_actions(options={}, &block)
17 | capture_haml do
18 | haml_tag 'fieldset', class: 'actions' do
19 | if request.referer.present? and not options[:no_cancel]
20 | haml_tag 'a', href: request.referer, class: "button red #{options[:class]}" do
21 | haml_tag 'span', class: options[:reset_icon] || 'icon-remove'
22 |
23 | haml_concat options[:cancel] || 'actions.cancel'.t
24 | end
25 | end
26 |
27 | capture_haml(&block) if block_given?
28 |
29 | haml_tag 'button', type: :submit, class: "button green #{options[:class]}" do
30 | haml_tag 'span', class: options[:icon] || 'icon-ok'
31 | haml_concat options[:submit] || 'actions.submit'.t
32 | end
33 | end
34 | end
35 | end
36 |
37 | def inputs_for model, form_builder
38 | cols = association_columns(model, :belongs_to)
39 | cols += content_columns(model)
40 | cols -= SKIPPED_COLUMNS
41 | cols.compact
42 |
43 |
44 | res = ''
45 | cols.each do |col|
46 | p col
47 | res << form_builder.input(col, placeholder: placeholder_for(model, col, form_builder))
48 | end
49 | res.html_safe
50 | end
51 |
52 | def placeholder_for(model, name, f)
53 | type = f.send(:default_input_type, name, model.class.columns_hash[name], {})
54 |
55 | s = I18n.t("simple_form.placeholders.#{model.class.name.underscore}.#{name}")
56 |
57 | if s =~ /translation missing/
58 | s = I18n.t("simple_form.placeholders.#{type}")
59 | end
60 |
61 | s
62 | end
63 |
64 | def association_columns object, *by_associations
65 | if object.present? && object.class.respond_to?(:reflections)
66 | object.class.reflections.collect do |name, association_reflection|
67 | if by_associations.present?
68 | if by_associations.include?(association_reflection.macro) && association_reflection.options[:polymorphic] != true
69 | name
70 | end
71 | else
72 | name
73 | end
74 | end.compact
75 | else
76 | []
77 | end
78 | end
79 |
80 | def default_columns_for_object
81 | cols = association_columns(:belongs_to)
82 | cols += content_columns
83 | cols -= SKIPPED_COLUMNS
84 | cols.compact
85 | end
86 |
87 | def content_columns object
88 | # TODO: NameError is raised by Inflector.constantize. Consider checking if it exists instead.
89 | klass = object.class
90 | return [] unless klass.respond_to?(:content_columns)
91 | klass.content_columns.collect { |c| c.name.to_sym }.compact
92 | end
93 |
94 | end
95 |
--------------------------------------------------------------------------------
/test/exoplanets/vendor/assets/javascripts/shaders/FilmShader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | *
4 | * Film grain & scanlines shader
5 | *
6 | * - ported from HLSL to WebGL / GLSL
7 | * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html
8 | *
9 | * Screen Space Static Postprocessor
10 | *
11 | * Produces an analogue noise overlay similar to a film grain / TV static
12 | *
13 | * Original implementation and noise algorithm
14 | * Pat 'Hawthorne' Shearon
15 | *
16 | * Optimized scanlines + noise version with intensity scaling
17 | * Georg 'Leviathan' Steinrohder
18 | *
19 | * This version is provided under a Creative Commons Attribution 3.0 License
20 | * http://creativecommons.org/licenses/by/3.0/
21 | */
22 |
23 | THREE.FilmShader = {
24 |
25 | uniforms: {
26 |
27 | "tDiffuse": { type: "t", value: null },
28 | "time": { type: "f", value: 0.0 },
29 | "nIntensity": { type: "f", value: 0.5 },
30 | "sIntensity": { type: "f", value: 0.05 },
31 | "sCount": { type: "f", value: 4096 },
32 | "grayscale": { type: "i", value: 1 }
33 |
34 | },
35 |
36 | vertexShader: [
37 |
38 | "varying vec2 vUv;",
39 |
40 | "void main() {",
41 |
42 | "vUv = uv;",
43 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
44 |
45 | "}"
46 |
47 | ].join("\n"),
48 |
49 | fragmentShader: [
50 |
51 | // control parameter
52 | "uniform float time;",
53 |
54 | "uniform bool grayscale;",
55 |
56 | // noise effect intensity value (0 = no effect, 1 = full effect)
57 | "uniform float nIntensity;",
58 |
59 | // scanlines effect intensity value (0 = no effect, 1 = full effect)
60 | "uniform float sIntensity;",
61 |
62 | // scanlines effect count value (0 = no effect, 4096 = full effect)
63 | "uniform float sCount;",
64 |
65 | "uniform sampler2D tDiffuse;",
66 |
67 | "varying vec2 vUv;",
68 |
69 | "void main() {",
70 |
71 | // sample the source
72 | "vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
73 |
74 | // make some noise
75 | "float x = vUv.x * vUv.y * time * 1000.0;",
76 | "x = mod( x, 13.0 ) * mod( x, 123.0 );",
77 | "float dx = mod( x, 0.01 );",
78 |
79 | // add noise
80 | "vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );",
81 |
82 | // get us a sine and cosine
83 | "vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
84 |
85 | // add scanlines
86 | "cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
87 |
88 | // interpolate between source and result by intensity
89 | "cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
90 |
91 | // convert to grayscale if desired
92 | "if( grayscale ) {",
93 |
94 | "cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
95 |
96 | "}",
97 |
98 | "gl_FragColor = vec4( cResult, cTextureScreen.a );",
99 |
100 | "}"
101 |
102 | ].join("\n")
103 |
104 | };
105 |
--------------------------------------------------------------------------------