├── .gitignore
├── Capfile
├── Gemfile
├── Gemfile.lock
├── README
├── README.md
├── Rakefile
├── app
├── assets
│ ├── images
│ │ ├── .keep
│ │ ├── bg.png
│ │ ├── capture.png
│ │ └── loading.gif
│ ├── javascripts
│ │ ├── application.js
│ │ └── jquery.timeago.js
│ └── stylesheets
│ │ ├── application.css.scss
│ │ ├── framework_and_overrides.css.scss
│ │ └── welcome.css.scss
├── controllers
│ ├── application_controller.rb
│ ├── concerns
│ │ └── .keep
│ ├── sessions_controller.rb
│ └── welcome_controller.rb
├── helpers
│ ├── application_helper.rb
│ └── welcome_helper.rb
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ ├── concerns
│ │ └── .keep
│ └── user.rb
└── views
│ ├── layouts
│ └── application.html.haml
│ └── welcome
│ └── new.html.haml
├── bin
├── bundle
├── delayed_job
├── rails
└── rake
├── config.ru
├── config
├── application.example.yml
├── application.rb
├── boot.rb
├── deploy.rb
├── environment.rb
├── environments
│ ├── development.rb
│ ├── production.rb
│ └── test.rb
├── initializers
│ ├── algolia.rb
│ ├── backtrace_silencers.rb
│ ├── filter_parameter_logging.rb
│ ├── inflections.rb
│ ├── mime_types.rb
│ ├── omniauth.rb
│ ├── secret_token.rb
│ ├── session_store.rb
│ ├── simple_form.rb
│ ├── simple_form_bootstrap.rb
│ └── wrap_parameters.rb
├── locales
│ ├── en.yml
│ └── simple_form.en.yml
├── production.pill
└── routes.rb
├── db
├── migrate
│ ├── 20140329054556_create_users.rb
│ └── 20140329061757_create_delayed_jobs.rb
├── schema.rb
└── seeds.rb
├── lib
├── assets
│ └── .keep
├── tasks
│ └── .keep
└── templates
│ └── haml
│ └── scaffold
│ └── _form.html.haml
├── public
├── 404.html
├── 422.html
├── 500.html
├── favicon.ico
├── humans.txt
└── robots.txt
├── test
├── controllers
│ ├── .keep
│ └── welcome_controller_test.rb
├── factories
│ └── users.rb
├── fixtures
│ └── .keep
├── helpers
│ ├── .keep
│ └── welcome_helper_test.rb
├── integration
│ └── .keep
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ └── user_test.rb
└── test_helper.rb
└── vendor
└── assets
├── javascripts
└── .keep
└── stylesheets
└── .keep
/.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 | /db/*.sqlite3-journal
21 | /log/*
22 | /tmp/*
23 |
24 | # various artifacts
25 | **.war
26 | *.rbc
27 | *.sassc
28 | .rspec
29 | .redcar/
30 | .sass-cache
31 | /config/config.yml
32 | /config/database.yml
33 | /coverage.data
34 | /coverage/
35 | /db/*.javadb/
36 | /db/*.sqlite3
37 | /doc/api/
38 | /doc/app/
39 | /doc/features.html
40 | /doc/specs.html
41 | /public/cache
42 | /public/stylesheets/compiled
43 | /public/system/*
44 | /spec/tmp/*
45 | /cache
46 | /capybara*
47 | /capybara-*.html
48 | /gems
49 | /specifications
50 | rerun.txt
51 | pickle-email-*.html
52 | .zeus.sock
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 | # Environment files that may contain sensitive data
79 | .env
80 | .powenv
81 |
82 | # Ignore application configuration
83 | /config/application.yml
84 |
--------------------------------------------------------------------------------
/Capfile:
--------------------------------------------------------------------------------
1 | load 'deploy'
2 | load 'deploy/assets'
3 | load 'config/deploy'
4 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 | ruby '2.1.2'
3 | gem 'rails', '4.0.4'
4 | gem 'sqlite3'
5 | gem 'sass-rails', '~> 4.0.2'
6 | gem 'uglifier', '>= 1.3.0'
7 | gem 'coffee-rails', '~> 4.0.0'
8 | gem 'jquery-rails'
9 | gem 'jbuilder', '~> 1.2'
10 | gem 'bootstrap-sass'
11 | gem 'figaro'
12 | gem 'haml-rails'
13 | gem 'omniauth'
14 | gem 'omniauth-facebook'
15 | gem 'koala'
16 | gem 'simple_form'
17 | gem 'thin'
18 | gem 'delayed_job'
19 | gem 'delayed_job_active_record'
20 | gem 'algoliasearch-rails'
21 | gem 'hogan_assets'
22 | gem 'bourbon'
23 | gem 'bluepill'
24 | gem 'therubyracer'
25 | gem 'hipchat'
26 | gem "font-awesome-rails"
27 |
28 | group :development do
29 | gem 'capistrano', '< 3.0.0'
30 | gem 'rvm-capistrano'
31 | gem 'better_errors'
32 | gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
33 | gem 'html2haml'
34 | gem 'quiet_assets'
35 | gem 'rails_layout'
36 | end
37 |
38 | group :development, :test do
39 | gem 'factory_girl_rails'
40 | end
41 |
42 | group :test do
43 | gem 'minitest-spec-rails'
44 | gem 'minitest-wscolor'
45 | end
46 |
47 | group :production do
48 | gem 'mysql2'
49 | end
50 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actionmailer (4.0.4)
5 | actionpack (= 4.0.4)
6 | mail (~> 2.5.4)
7 | actionpack (4.0.4)
8 | activesupport (= 4.0.4)
9 | builder (~> 3.1.0)
10 | erubis (~> 2.7.0)
11 | rack (~> 1.5.2)
12 | rack-test (~> 0.6.2)
13 | activemodel (4.0.4)
14 | activesupport (= 4.0.4)
15 | builder (~> 3.1.0)
16 | activerecord (4.0.4)
17 | activemodel (= 4.0.4)
18 | activerecord-deprecated_finders (~> 1.0.2)
19 | activesupport (= 4.0.4)
20 | arel (~> 4.0.0)
21 | activerecord-deprecated_finders (1.0.3)
22 | activesupport (4.0.4)
23 | i18n (~> 0.6, >= 0.6.9)
24 | minitest (~> 4.2)
25 | multi_json (~> 1.3)
26 | thread_safe (~> 0.1)
27 | tzinfo (~> 0.3.37)
28 | addressable (2.3.6)
29 | algoliasearch (1.2.14)
30 | httpclient (~> 2.4)
31 | json (>= 1.5.1)
32 | algoliasearch-rails (1.11.11)
33 | algoliasearch (>= 1.2.14)
34 | json (>= 1.5.1)
35 | arel (4.0.2)
36 | atomic (1.1.16)
37 | better_errors (1.1.0)
38 | coderay (>= 1.0.0)
39 | erubis (>= 2.6.6)
40 | binding_of_caller (0.7.2)
41 | debug_inspector (>= 0.0.1)
42 | bluepill (0.0.64)
43 | activesupport (>= 3.0.0)
44 | daemons (~> 1.1.4)
45 | i18n (>= 0.5.0)
46 | state_machine (~> 1.1)
47 | bootstrap-sass (3.1.1.0)
48 | sass (~> 3.2)
49 | bourbon (3.1.8)
50 | sass (>= 3.2.0)
51 | thor
52 | builder (3.1.4)
53 | capistrano (2.15.5)
54 | highline
55 | net-scp (>= 1.0.0)
56 | net-sftp (>= 2.0.0)
57 | net-ssh (>= 2.0.14)
58 | net-ssh-gateway (>= 1.1.0)
59 | coderay (1.1.0)
60 | coffee-rails (4.0.1)
61 | coffee-script (>= 2.2.0)
62 | railties (>= 4.0.0, < 5.0)
63 | coffee-script (2.2.0)
64 | coffee-script-source
65 | execjs
66 | coffee-script-source (1.7.0)
67 | daemons (1.1.9)
68 | debug_inspector (0.0.2)
69 | delayed_job (4.0.0)
70 | activesupport (>= 3.0, < 4.1)
71 | delayed_job_active_record (4.0.0)
72 | activerecord (>= 3.0, < 4.1)
73 | delayed_job (>= 3.0, < 4.1)
74 | erubis (2.7.0)
75 | eventmachine (1.0.3)
76 | execjs (2.0.2)
77 | factory_girl (4.4.0)
78 | activesupport (>= 3.0.0)
79 | factory_girl_rails (4.4.1)
80 | factory_girl (~> 4.4.0)
81 | railties (>= 3.0.0)
82 | faraday (0.8.9)
83 | multipart-post (~> 1.2.0)
84 | figaro (0.7.0)
85 | bundler (~> 1.0)
86 | rails (>= 3, < 5)
87 | font-awesome-rails (4.0.3.1)
88 | railties (>= 3.2, < 5.0)
89 | haml (4.1.0.beta.1)
90 | tilt
91 | haml-rails (0.5.3)
92 | actionpack (>= 4.0.1)
93 | activesupport (>= 4.0.1)
94 | haml (>= 3.1, < 5.0)
95 | railties (>= 4.0.1)
96 | hashie (2.0.5)
97 | highline (1.6.21)
98 | hike (1.2.3)
99 | hipchat (1.0.1)
100 | httparty
101 | hogan_assets (1.6.0)
102 | execjs (>= 1.2.9)
103 | sprockets (>= 2.0.3)
104 | tilt (>= 1.3.3)
105 | hpricot (0.8.6)
106 | html2haml (1.0.1)
107 | erubis (~> 2.7.0)
108 | haml (>= 4.0.0.rc.1)
109 | hpricot (~> 0.8.6)
110 | ruby_parser (~> 3.1.1)
111 | httparty (0.12.0)
112 | json (~> 1.8)
113 | multi_xml (>= 0.5.2)
114 | httpclient (2.5.3.3)
115 | i18n (0.6.9)
116 | jbuilder (1.5.3)
117 | activesupport (>= 3.0.0)
118 | multi_json (>= 1.2.0)
119 | jquery-rails (3.1.0)
120 | railties (>= 3.0, < 5.0)
121 | thor (>= 0.14, < 2.0)
122 | json (1.8.1)
123 | jwt (0.1.11)
124 | multi_json (>= 1.5)
125 | koala (1.6.0)
126 | addressable (~> 2.2)
127 | faraday (~> 0.8)
128 | multi_json (~> 1.3)
129 | libv8 (3.16.14.3)
130 | mail (2.5.4)
131 | mime-types (~> 1.16)
132 | treetop (~> 1.4.8)
133 | mime-types (1.25.1)
134 | minitest (4.7.5)
135 | minitest-spec-rails (4.7.6)
136 | minitest (~> 4.7)
137 | rails (>= 3.0, < 4.1)
138 | minitest-wscolor (0.0.3)
139 | minitest (>= 2.3.1)
140 | multi_json (1.9.2)
141 | multi_xml (0.5.5)
142 | multipart-post (1.2.0)
143 | mysql2 (0.3.15)
144 | net-scp (1.2.1)
145 | net-ssh (>= 2.6.5)
146 | net-sftp (2.1.2)
147 | net-ssh (>= 2.6.5)
148 | net-ssh (2.9.1)
149 | net-ssh-gateway (1.2.0)
150 | net-ssh (>= 2.6.5)
151 | oauth2 (0.9.3)
152 | faraday (>= 0.8, < 0.10)
153 | jwt (~> 0.1.8)
154 | multi_json (~> 1.3)
155 | multi_xml (~> 0.5)
156 | rack (~> 1.2)
157 | omniauth (1.2.1)
158 | hashie (>= 1.2, < 3)
159 | rack (~> 1.0)
160 | omniauth-facebook (1.5.1)
161 | omniauth-oauth2 (~> 1.1.0)
162 | omniauth-oauth2 (1.1.2)
163 | faraday (>= 0.8, < 0.10)
164 | multi_json (~> 1.3)
165 | oauth2 (~> 0.9.3)
166 | omniauth (~> 1.2)
167 | polyglot (0.3.4)
168 | quiet_assets (1.0.2)
169 | railties (>= 3.1, < 5.0)
170 | rack (1.5.2)
171 | rack-test (0.6.2)
172 | rack (>= 1.0)
173 | rails (4.0.4)
174 | actionmailer (= 4.0.4)
175 | actionpack (= 4.0.4)
176 | activerecord (= 4.0.4)
177 | activesupport (= 4.0.4)
178 | bundler (>= 1.3.0, < 2.0)
179 | railties (= 4.0.4)
180 | sprockets-rails (~> 2.0.0)
181 | rails_layout (1.0.13)
182 | railties (4.0.4)
183 | actionpack (= 4.0.4)
184 | activesupport (= 4.0.4)
185 | rake (>= 0.8.7)
186 | thor (>= 0.18.1, < 2.0)
187 | rake (10.2.2)
188 | ref (1.0.5)
189 | ruby_parser (3.1.3)
190 | sexp_processor (~> 4.1)
191 | rvm-capistrano (1.5.4)
192 | capistrano (~> 2.15.4)
193 | sass (3.2.18)
194 | sass-rails (4.0.2)
195 | railties (>= 4.0.0, < 5.0)
196 | sass (~> 3.2.0)
197 | sprockets (~> 2.8, <= 2.11.0)
198 | sprockets-rails (~> 2.0.0)
199 | sexp_processor (4.4.3)
200 | simple_form (3.0.1)
201 | actionpack (>= 4.0.0, < 4.1)
202 | activemodel (>= 4.0.0, < 4.1)
203 | sprockets (2.11.0)
204 | hike (~> 1.2)
205 | multi_json (~> 1.0)
206 | rack (~> 1.0)
207 | tilt (~> 1.1, != 1.3.0)
208 | sprockets-rails (2.0.1)
209 | actionpack (>= 3.0)
210 | activesupport (>= 3.0)
211 | sprockets (~> 2.8)
212 | sqlite3 (1.3.9)
213 | state_machine (1.2.0)
214 | therubyracer (0.12.1)
215 | libv8 (~> 3.16.14.0)
216 | ref
217 | thin (1.6.2)
218 | daemons (>= 1.0.9)
219 | eventmachine (>= 1.0.0)
220 | rack (>= 1.0.0)
221 | thor (0.19.1)
222 | thread_safe (0.3.1)
223 | atomic (>= 1.1.7, < 2)
224 | tilt (1.4.1)
225 | treetop (1.4.15)
226 | polyglot
227 | polyglot (>= 0.3.1)
228 | tzinfo (0.3.39)
229 | uglifier (2.5.0)
230 | execjs (>= 0.3.0)
231 | json (>= 1.8.0)
232 |
233 | PLATFORMS
234 | ruby
235 |
236 | DEPENDENCIES
237 | algoliasearch-rails
238 | better_errors
239 | binding_of_caller
240 | bluepill
241 | bootstrap-sass
242 | bourbon
243 | capistrano (< 3.0.0)
244 | coffee-rails (~> 4.0.0)
245 | delayed_job
246 | delayed_job_active_record
247 | factory_girl_rails
248 | figaro
249 | font-awesome-rails
250 | haml-rails
251 | hipchat
252 | hogan_assets
253 | html2haml
254 | jbuilder (~> 1.2)
255 | jquery-rails
256 | koala
257 | minitest-spec-rails
258 | minitest-wscolor
259 | mysql2
260 | omniauth
261 | omniauth-facebook
262 | quiet_assets
263 | rails (= 4.0.4)
264 | rails_layout
265 | rvm-capistrano
266 | sass-rails (~> 4.0.2)
267 | simple_form
268 | sqlite3
269 | therubyracer
270 | thin
271 | uglifier (>= 1.3.0)
272 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Facebook Search
2 | ===============
3 |
4 | This is the Rails 4 application providing [Facebook Search](http://facebook.algolia.com). It's based on [algoliasearch-client-ruby](https://github.com/algolia/algoliasearch-client-ruby), [omniauth-facebook](https://github.com/mkdynamic/omniauth-facebook) and [koala](https://github.com/arsduo/koala).
5 |
6 | Index settings
7 | ----------------------
8 |
9 | ```ruby
10 | Algolia.init application_id: ENV['ALGOLIA_APPLICATION_ID'], api_key: ENV['ALGOLIA_API_KEY']
11 | INDEX = Algolia::Index.new("facebook_#{Rails.env}")
12 | INDEX.set_settings({
13 | attributesToIndex: ['unordered(description)', 'unordered(name)', 'unordered(message)', 'unordered(comments.data.message)', 'unordered(story)'],
14 | customRanking: ['desc(likes_count)']
15 | })
16 | ```
17 |
18 | Record definition
19 | ------------------
20 |
21 | ```ruby
22 | BATCH_SIZE = 1000
23 | def crawl_feed!(token)
24 | @graph = Koala::Facebook::API.new(token)
25 | objects = []
26 | feed = @graph.get_connections("me", "feed")
27 | loop do
28 | feed.each do |f|
29 | objects << build_algolia_object(f)
30 | if objects.length == BATCH_SIZE
31 | INDEX.add_objects(objects)
32 | objects = []
33 | end
34 | end
35 | feed = feed.next_page
36 | break if feed.nil? || feed.empty?
37 | end
38 | INDEX.add_objects(objects) unless objects.empty?
39 | end
40 |
41 | private
42 | def build_algolia_object(f)
43 | f.merge objectID: "#{uid}_#{f['id']}",
44 | _tags: [ uid, f['type'] ],
45 | created_time: DateTime.parse(f['created_time']).to_i,
46 | likes_count: f['likes'].try(:[], 'data').try(:length).to_i
47 | end
48 | ```
49 |
50 | Secure indexing
51 | ----------------
52 |
53 | Each record (item) is tagged with its owner id (Your Facebook UID) and we use a per-user [generated secured API key](http://www.algolia.com/doc#SecurityUser) to call Algolia's REST API.
54 |
55 | ```ruby
56 | @secured_api_key = Algolia.generate_secured_api_key(ENV['ALGOLIA_API_KEY_SEARCH_ONLY'], current_user.uid)
57 | ```
58 |
59 | ```js
60 | var algolia = new AlgoliaSearch('#{ENV['ALGOLIA_APPLICATION_ID']}', '#{@secured_api_key}');
61 | algolia.setSecurityTags('#{current_user.uid}');
62 | ```
63 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Facebook Search
2 | =========
3 |
4 | This application was generated with the [rails_apps_composer](https://github.com/RailsApps/rails_apps_composer) gem
5 | provided by the [RailsApps Project](http://railsapps.github.io/).
6 |
7 | Diagnostics
8 | -
9 |
10 | This application was built with recipes that are known to work together.
11 |
12 | This application was built with preferences that are NOT known to work
13 | together.
14 |
15 | If the application doesn’t work as expected, please [report an issue](https://github.com/RailsApps/rails_apps_composer/issues)
16 | and include these diagnostics:
17 |
18 | We’d also like to know if you’ve found combinations of recipes or
19 | preferences that do work together.
20 |
21 | Recipes:
22 |
23 | * apps4
24 | * controllers
25 | * core
26 | * email
27 | * extras
28 | * frontend
29 | * gems
30 | * git
31 | * init
32 | * models
33 | * prelaunch
34 | * railsapps
35 | * readme
36 | * routes
37 | * saas
38 | * setup
39 | * testing
40 | * views
41 |
42 | Preferences:
43 |
44 | * git: true
45 | * apps4: none
46 | * dev_webserver: thin
47 | * prod_webserver: thin
48 | * database: sqlite
49 | * templates: haml
50 | * unit_test: minitest
51 | * integration: none
52 | * continuous_testing: none
53 | * fixtures: factory_girl
54 | * frontend: bootstrap3
55 | * email: none
56 | * authentication: omniauth
57 | * omniauth_provider: linkedin
58 | * authorization: none
59 | * form_builder: simple_form
60 | * starter_app: none
61 | * rvmrc: false
62 | * quiet_assets: true
63 | * local_env_file: figaro
64 | * better_errors: true
65 |
66 | Ruby on Rails
67 | ---
68 |
69 | This application requires:
70 |
71 | - Ruby
72 | - Rails
73 |
74 | Learn more about [Installing Rails](http://railsapps.github.io/installing-rails.html).
75 |
76 | Database
77 | ---
78 |
79 | This application uses SQLite with ActiveRecord.
80 |
81 | Development
82 | -
83 |
84 | - Template Engine: Haml
85 | - Testing Framework: Test::Unit
86 | - Front-end Framework: Bootstrap 3.0 (Sass)
87 | - Form Builder: SimpleForm
88 | - Authentication: OmniAuth
89 | - Authorization: None
90 | - Admin: None
91 |
92 |
93 |
94 |
95 |
96 |
97 | delivery is disabled in development.
98 |
99 | Getting Started
100 |
101 |
102 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
103 |
104 | Documentation and Support
105 |
106 |
107 | This is the only documentation.
108 |
109 | #### Issues
110 |
111 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
112 |
113 | Similar Projects
114 | -
115 |
116 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
117 |
118 | Contributing
119 | --
120 |
121 | If you make improvements to this application, please share with others.
122 |
123 | - Fork the project on GitHub.
124 | - Make your feature addition or bug fix.
125 | - Commit with Git.
126 | - Send the author a pull request.
127 |
128 | If you add functionality to this application, create an alternative
129 | implementation, or build an application that is similar, please contact
130 | me and I’ll add a note to the README so that others can find your work.
131 |
132 | Credits
133 | --
134 |
135 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
136 |
137 | License
138 | --
139 |
140 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
141 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | FacebookSearch::Application.load_tasks
7 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/assets/images/.keep
--------------------------------------------------------------------------------
/app/assets/images/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/assets/images/bg.png
--------------------------------------------------------------------------------
/app/assets/images/capture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/assets/images/capture.png
--------------------------------------------------------------------------------
/app/assets/images/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/assets/images/loading.gif
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require jquery
14 | //= require jquery_ujs
15 | //= require bootstrap
16 | //= require algolia/algoliasearch.min
17 | //= require hogan
18 | //= require jquery.timeago
19 | //= require_tree .
20 |
--------------------------------------------------------------------------------
/app/assets/javascripts/jquery.timeago.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Timeago is a jQuery plugin that makes it easy to support automatically
3 | * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
4 | *
5 | * @name timeago
6 | * @version 1.4.0
7 | * @requires jQuery v1.2.3+
8 | * @author Ryan McGeary
9 | * @license MIT License - http://www.opensource.org/licenses/mit-license.php
10 | *
11 | * For usage and examples, visit:
12 | * http://timeago.yarp.com/
13 | *
14 | * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
15 | */
16 |
17 | (function (factory) {
18 | if (typeof define === 'function' && define.amd) {
19 | // AMD. Register as an anonymous module.
20 | define(['jquery'], factory);
21 | } else {
22 | // Browser globals
23 | factory(jQuery);
24 | }
25 | }(function ($) {
26 | $.timeago = function(timestamp) {
27 | if (timestamp instanceof Date) {
28 | return inWords(timestamp);
29 | } else if (typeof timestamp === "string") {
30 | return inWords($.timeago.parse(timestamp));
31 | } else if (typeof timestamp === "number") {
32 | return inWords(new Date(timestamp));
33 | } else {
34 | return inWords($.timeago.datetime(timestamp));
35 | }
36 | };
37 | var $t = $.timeago;
38 |
39 | $.extend($.timeago, {
40 | settings: {
41 | refreshMillis: 60000,
42 | allowPast: true,
43 | allowFuture: false,
44 | localeTitle: false,
45 | cutoff: 0,
46 | strings: {
47 | prefixAgo: null,
48 | prefixFromNow: null,
49 | suffixAgo: "ago",
50 | suffixFromNow: "from now",
51 | inPast: 'any moment now',
52 | seconds: "less than a minute",
53 | minute: "about a minute",
54 | minutes: "%d minutes",
55 | hour: "about an hour",
56 | hours: "about %d hours",
57 | day: "a day",
58 | days: "%d days",
59 | month: "about a month",
60 | months: "%d months",
61 | year: "about a year",
62 | years: "%d years",
63 | wordSeparator: " ",
64 | numbers: []
65 | }
66 | },
67 |
68 | inWords: function(distanceMillis) {
69 | if(!this.settings.allowPast && ! this.settings.allowFuture) {
70 | throw 'timeago allowPast and allowFuture settings can not both be set to false.';
71 | }
72 |
73 | var $l = this.settings.strings;
74 | var prefix = $l.prefixAgo;
75 | var suffix = $l.suffixAgo;
76 | if (this.settings.allowFuture) {
77 | if (distanceMillis < 0) {
78 | prefix = $l.prefixFromNow;
79 | suffix = $l.suffixFromNow;
80 | }
81 | }
82 |
83 | if(!this.settings.allowPast && distanceMillis >= 0) {
84 | return this.settings.strings.inPast;
85 | }
86 |
87 | var seconds = Math.abs(distanceMillis) / 1000;
88 | var minutes = seconds / 60;
89 | var hours = minutes / 60;
90 | var days = hours / 24;
91 | var years = days / 365;
92 |
93 | function substitute(stringOrFunction, number) {
94 | var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
95 | var value = ($l.numbers && $l.numbers[number]) || number;
96 | return string.replace(/%d/i, value);
97 | }
98 |
99 | var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
100 | seconds < 90 && substitute($l.minute, 1) ||
101 | minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
102 | minutes < 90 && substitute($l.hour, 1) ||
103 | hours < 24 && substitute($l.hours, Math.round(hours)) ||
104 | hours < 42 && substitute($l.day, 1) ||
105 | days < 30 && substitute($l.days, Math.round(days)) ||
106 | days < 45 && substitute($l.month, 1) ||
107 | days < 365 && substitute($l.months, Math.round(days / 30)) ||
108 | years < 1.5 && substitute($l.year, 1) ||
109 | substitute($l.years, Math.round(years));
110 |
111 | var separator = $l.wordSeparator || "";
112 | if ($l.wordSeparator === undefined) { separator = " "; }
113 | return $.trim([prefix, words, suffix].join(separator));
114 | },
115 |
116 | parse: function(iso8601) {
117 | var s = $.trim(iso8601);
118 | s = s.replace(/\.\d+/,""); // remove milliseconds
119 | s = s.replace(/-/,"/").replace(/-/,"/");
120 | s = s.replace(/T/," ").replace(/Z/," UTC");
121 | s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
122 | s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900
123 | return new Date(s);
124 | },
125 | datetime: function(elem) {
126 | var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
127 | return $t.parse(iso8601);
128 | },
129 | isTime: function(elem) {
130 | // jQuery's `is()` doesn't play well with HTML5 in IE
131 | return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
132 | }
133 | });
134 |
135 | // functions that can be called via $(el).timeago('action')
136 | // init is default when no action is given
137 | // functions are called with context of a single element
138 | var functions = {
139 | init: function(){
140 | var refresh_el = $.proxy(refresh, this);
141 | refresh_el();
142 | var $s = $t.settings;
143 | if ($s.refreshMillis > 0) {
144 | this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
145 | }
146 | },
147 | update: function(time){
148 | var parsedTime = $t.parse(time);
149 | $(this).data('timeago', { datetime: parsedTime });
150 | if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
151 | refresh.apply(this);
152 | },
153 | updateFromDOM: function(){
154 | $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) });
155 | refresh.apply(this);
156 | },
157 | dispose: function () {
158 | if (this._timeagoInterval) {
159 | window.clearInterval(this._timeagoInterval);
160 | this._timeagoInterval = null;
161 | }
162 | }
163 | };
164 |
165 | $.fn.timeago = function(action, options) {
166 | var fn = action ? functions[action] : functions.init;
167 | if(!fn){
168 | throw new Error("Unknown function name '"+ action +"' for timeago");
169 | }
170 | // each over objects here and call the requested function
171 | this.each(function(){
172 | fn.call(this, options);
173 | });
174 | return this;
175 | };
176 |
177 | function refresh() {
178 | var data = prepareData(this);
179 | var $s = $t.settings;
180 |
181 | if (!isNaN(data.datetime)) {
182 | if ( $s.cutoff == 0 || distance(data.datetime) < $s.cutoff) {
183 | $(this).text(inWords(data.datetime));
184 | }
185 | }
186 | return this;
187 | }
188 |
189 | function prepareData(element) {
190 | element = $(element);
191 | if (!element.data("timeago")) {
192 | element.data("timeago", { datetime: $t.datetime(element) });
193 | var text = $.trim(element.text());
194 | if ($t.settings.localeTitle) {
195 | element.attr("title", element.data('timeago').datetime.toLocaleString());
196 | } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
197 | element.attr("title", text);
198 | }
199 | }
200 | return element.data("timeago");
201 | }
202 |
203 | function inWords(date) {
204 | return $t.inWords(distance(date));
205 | }
206 |
207 | function distance(date) {
208 | return (new Date().getTime() - date.getTime());
209 | }
210 |
211 | // fix for IE6 suckage
212 | document.createElement("abbr");
213 | document.createElement("time");
214 | }));
215 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any styles
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 | * file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | *= require font-awesome
16 | */
17 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/framework_and_overrides.css.scss:
--------------------------------------------------------------------------------
1 | @import "bootstrap";
2 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/welcome.css.scss:
--------------------------------------------------------------------------------
1 | @import "bootstrap/variables";
2 | @import "bourbon";
3 |
4 | html, body {
5 | height: 100%;
6 | }
7 |
8 | body {
9 | background-color: #4D68A2;
10 | background-image: -webkit-linear-gradient(top, #354776 0%,#4D68A2 100%);
11 | background-image: -moz-linear-gradient(top, #354776 0%,#4D68A2 100%);
12 | background-image: -o-linear-gradient(top, #354776 0%,#4D68A2 100%);
13 | background-image: linear-gradient(top, #354776 0%,#4D68A2 100%);
14 | }
15 |
16 | h1 small {
17 | color: #dedede;
18 | }
19 |
20 | #stats {
21 | float: left;
22 | margin-top: 15px;
23 | font-size: 0.8em;
24 | }
25 |
26 | #social-links {
27 | float: right;
28 | margin-top: 10px;
29 | }
30 |
31 | #signin-link {
32 | display: block;
33 | position: absolute;
34 | top: 30%;
35 | left: 0px;
36 | right: 0px;
37 | color: white;
38 |
39 | a.login, a.login:hover {
40 | display: block;
41 | margin: 0px auto;
42 | margin-bottom: 30px;
43 | width: 250px;
44 | text-align: center;
45 | background: #1A85BD;
46 | padding: 5px 20px;
47 | border-radius: 10px;
48 | color: white;
49 | font-size: 25px;
50 | text-decoration: none;
51 | }
52 |
53 | p, h1 {
54 | margin-top: 10px;
55 | margin-bottom: 30px;
56 | }
57 | }
58 |
59 | #signout-link {
60 | display: block;
61 | position: absolute;
62 | top: 0px;
63 | right: 10%;
64 | background: #1A85BD;
65 | padding: 5px 20px;
66 | border-bottom-right-radius: 10px;
67 | border-bottom-left-radius: 10px;
68 |
69 | a {
70 | color: white;
71 | }
72 | }
73 |
74 | #search-form {
75 | margin: 0px auto;
76 | padding-top: 20px;
77 | width: 100%;
78 | max-width: 800px;
79 |
80 | small {
81 | display: block;
82 | color: #dedede;
83 | margin-top: 5px;
84 | text-align: right;
85 | img {
86 | height: 1.5em;
87 | }
88 | }
89 | }
90 |
91 | .container-wrapper {
92 | background: url(image-path('bg.png')) repeat;
93 | position: absolute;
94 | top: 80px;
95 | bottom: 0px;
96 | left: 0px;
97 | right: 0px;
98 | border-top: 1px solid #999;
99 | overflow-y: scroll;
100 | }
101 |
102 | #hits-wrapper .container {
103 | background: #fff;
104 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.15),-1px 0 0 rgba(0,0,0,0.03),1px 0 0 rgba(0,0,0,0.03),0 1px 0 rgba(0,0,0,0.12);
105 | -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.15),-1px 0 0 rgba(0,0,0,0.03),1px 0 0 rgba(0,0,0,0.03),0 1px 0 rgba(0,0,0,0.12);
106 | box-shadow: 0 1px 1px rgba(0,0,0,0.15),-1px 0 0 rgba(0,0,0,0.03),1px 0 0 rgba(0,0,0,0.03),0 1px 0 rgba(0,0,0,0.12);
107 | font-size: 12px;
108 | color: #333;
109 | font-family: Helvetica, Arial, sans-serif;
110 | padding: 5px;
111 | padding-top: 10px;
112 | }
113 |
114 | #no-results, #loading {
115 | margin-top: 100px;
116 | font-size: 30px;
117 | color: #888;
118 |
119 | i {
120 | font-size: 60px;
121 | }
122 | }
123 |
124 | .icon-rotation {
125 | display: block !important;
126 | margin-bottom: 10px;
127 | @include animation(loading-animation-rotation 2s infinite linear);
128 | }
129 |
130 | @include keyframes(loading-animation-rotation) {
131 | from { @include transform(rotate(0deg)); }
132 | to { @include transform(rotate(360deg)); }
133 | }
134 |
135 | #hits, #facets {
136 | a {
137 | color: #3b5998;
138 | }
139 |
140 | a:hover {
141 | text-decoration: underline;
142 | color: #3b5998;
143 | }
144 | }
145 |
146 | #facets {
147 | .title {
148 | font-weight: bold;
149 | margin-left: 10px;
150 | }
151 |
152 | ul {
153 | border-bottom: 1px solid #e0e0e0;
154 | padding-bottom: 10px;
155 | margin-bottom: 10px;
156 | margin-left: 5px;
157 | }
158 |
159 | ul:last-child {
160 | border-bottom: none;
161 | }
162 |
163 | li.active {
164 | font-weight: bold;
165 | }
166 |
167 | a {
168 | color: #808080;
169 | }
170 | }
171 |
172 | #hits {
173 | dl dt {
174 | font-weight: normal;
175 | color: #999;
176 | }
177 |
178 | .company:last-child {
179 | border-bottom: none;
180 | }
181 |
182 | .hit {
183 | padding: 0px;
184 | border: 1px solid rgb(197, 202, 221);
185 | margin-bottom: 10px;
186 |
187 | em {
188 | font-weight: bold;
189 | font-style: normal;
190 | text-decoration: underline;
191 | }
192 |
193 | abbr {
194 | display: block;
195 | border: 0px;
196 | cursor: default;
197 | color: #9b9b9b;
198 | font-size: 0.8em;
199 | }
200 |
201 | .picture {
202 | max-width: 80%;
203 | }
204 |
205 | .title {
206 | padding: 5px 10px;
207 |
208 | img {
209 | height: 50px;
210 | vertical-align: top;
211 | float: left;
212 | }
213 |
214 | h4 {
215 | margin-left: 60px;
216 | font-weight: normal;
217 | font-size: 1.25em;
218 | line-height: 1.5;
219 | }
220 | }
221 |
222 | .content {
223 | border-top: 1px solid #eff2f5;
224 | padding: 10px;
225 | font-size: 1.2em;
226 |
227 | p {
228 | margin: 0px;
229 | padding: 0px;
230 | }
231 | }
232 |
233 | .actions {
234 | background-color: #eff2f5;
235 | color: #3b5998;
236 | border-top: 1px solid rgb(197, 202, 221);
237 | padding: 5px;
238 | font-weight: bold;
239 | text-align: right;
240 | }
241 |
242 | .comments {
243 | background-color: #eff2f5;
244 | color: #4e5665;
245 | border-top: 1px solid rgb(197, 202, 221);
246 | font-size: 1em;
247 | padding: 5px;
248 |
249 | .comment {
250 | margin-bottom: 5px;
251 |
252 | img {
253 | float: left;
254 | vertical-align: top;
255 | }
256 |
257 | p {
258 | margin: 0px;
259 | margin-left: 60px;
260 | margin-right: 10px;
261 | }
262 | }
263 | }
264 | }
265 | }
266 |
267 | #branding {
268 | .well {
269 | background: url("http://d3ibatyzauff7b.cloudfront.net/assets/flat/bg-blue.png");
270 | color: white;
271 | font-family: Ubuntu;
272 | font-size: 1.4em;
273 |
274 | p {
275 | margin-top: 20px;
276 | }
277 |
278 | .btn-danger {
279 | background: #ff5f5f;
280 | }
281 |
282 | .btn-danger:hover {
283 | border-color: #ff5f5f;
284 | }
285 |
286 | .btn-success {
287 | background: #13c4a5;
288 | }
289 |
290 | .btn-success:hover {
291 | border-color: #13c4a5;
292 | }
293 | }
294 | }
295 |
296 | @media(max-width: $screen-xs-max) {
297 | #signin-link {
298 | top: 10px;
299 | }
300 |
301 | #no-results, #loading {
302 | margin-top: 20px;
303 | margin-left: 10px;
304 | margin-right: 10px;
305 | }
306 |
307 | #hits .hit {
308 | padding: 3px 0px;
309 |
310 | .thumb {
311 | width: 40px;
312 | }
313 |
314 | .infos {
315 | width: 220px;
316 |
317 | .connections {
318 | font-size: 0.8em;
319 | span {
320 | display: none;
321 | }
322 | }
323 | }
324 | }
325 | }
326 |
327 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 |
6 | helper_method :current_user
7 | helper_method :user_signed_in?
8 | helper_method :correct_user?
9 |
10 | protected
11 | DEFAULT_HIPCHAT_PARAMS = {
12 | color: :green, room: ENV['HIPCHAT_ROOM'], notify: false, format: 'html'
13 | }
14 | def hipchat_notify!(message, params = {})
15 | params = DEFAULT_HIPCHAT_PARAMS.merge(params)
16 | escaped_msg = (params[:mentions] ? "@#{params[:mentions].join(' @')} " : '') + (params[:format] == 'text' ? message : CGI::escapeHTML(message).to_s)
17 | HipChat::Client.new(ENV['HIPCHAT_API_TOKEN'])[params[:room]].send('facebook', escaped_msg, color: params[:color], notify: params[:notify], message_format: params[:format])
18 | rescue
19 | # not fatal
20 | end
21 |
22 | private
23 | def current_user
24 | begin
25 | @current_user ||= User.find(session[:user_id]) if session[:user_id]
26 | rescue Exception => e
27 | nil
28 | end
29 | end
30 |
31 | def user_signed_in?
32 | return true if current_user
33 | end
34 |
35 | def correct_user?
36 | @user = User.find(params[:id])
37 | unless current_user == @user
38 | redirect_to root_url, :alert => "Access denied."
39 | end
40 | end
41 |
42 | def authenticate_user!
43 | if !current_user
44 | redirect_to root_url, :alert => 'You need to sign in for access to this page.'
45 | end
46 | end
47 |
48 | end
49 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/app/controllers/sessions_controller.rb:
--------------------------------------------------------------------------------
1 | class SessionsController < ApplicationController
2 |
3 | def new
4 | redirect_to '/auth/linkedin'
5 | end
6 |
7 | def create
8 | auth = request.env["omniauth.auth"]
9 | user = User.where(:provider => auth['provider'], :uid => auth['uid'].to_s).first || User.create_with_omniauth(auth)
10 | hipchat_notify! "#{user.name} (#{user.email}) signed in", color: :green, notify: true
11 | user.delay.crawl_feed!(auth.credentials.token)
12 | reset_session
13 | session[:user_id] = user.id
14 | if user.email.blank?
15 | redirect_to edit_user_path(user), :alert => "Please enter your email address."
16 | else
17 | redirect_to root_url, :notice => 'Signed in!'
18 | end
19 |
20 | end
21 |
22 | def destroy
23 | reset_session
24 | redirect_to root_url, :notice => 'Signed out!'
25 | end
26 |
27 | def failure
28 | redirect_to root_url, :alert => "Authentication error: #{params[:message].humanize}"
29 | end
30 |
31 | end
32 |
--------------------------------------------------------------------------------
/app/controllers/welcome_controller.rb:
--------------------------------------------------------------------------------
1 | class WelcomeController < ApplicationController
2 | def new
3 | @secured_api_key = Algolia.generate_secured_api_key(ENV['ALGOLIA_API_KEY_SEARCH_ONLY'], current_user.uid) if current_user
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/welcome_helper.rb:
--------------------------------------------------------------------------------
1 | module WelcomeHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/mailers/.keep
--------------------------------------------------------------------------------
/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/models/.keep
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/app/models/concerns/.keep
--------------------------------------------------------------------------------
/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | validates_presence_of :name
3 |
4 | def self.create_with_omniauth(auth)
5 | create! do |user|
6 | user.provider = auth['provider']
7 | user.uid = auth['uid']
8 | if auth['info']
9 | user.name = auth['info']['name'] || ""
10 | user.email = auth['info']['email'] || ""
11 | end
12 | end
13 | end
14 |
15 | BATCH_SIZE = 1000
16 | def crawl_feed!(token)
17 | @graph = Koala::Facebook::API.new(token)
18 | objects = []
19 | feed = @graph.get_connections("me", "feed")
20 | loop do
21 | feed.each do |f|
22 | objects << build_algolia_object(f)
23 | if objects.length == BATCH_SIZE
24 | INDEX.add_objects(objects)
25 | objects = []
26 | end
27 | end
28 | feed = feed.next_page
29 | break if feed.nil? || feed.empty?
30 | end
31 | INDEX.add_objects(objects) unless objects.empty?
32 | end
33 |
34 | private
35 | def build_algolia_object(f)
36 | f.merge objectID: "#{uid}_#{f['id']}",
37 | _tags: [ uid, f['type'] ],
38 | created_time_i: DateTime.parse(f['created_time']).to_i,
39 | likes_count: f['likes'].try(:[], 'data').try(:length).to_i,
40 | story_tags: f['story_tags'].try(:values).try(:flatten),
41 | comments_count: f['comments'].try(:[], 'data').try(:length).to_i
42 | end
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.haml:
--------------------------------------------------------------------------------
1 | !!!
2 | %html
3 | %head
4 | %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimal-ui"}
5 | %title= content_for?(:title) ? yield(:title) : 'Facebook Search powered by Algolia'
6 | %meta{:name => "description", :content => "Facebook feed search powered by Algolia."}
7 | %link{:rel => "shortcut icon", :href=> '/favicon.ico'}
8 | %link{href: 'http://fonts.googleapis.com/css?family=Ubuntu:300', rel: 'stylesheet', type: 'text/css'}
9 | = stylesheet_link_tag 'application', media: 'all'
10 | = javascript_include_tag 'application'
11 | = csrf_meta_tags
12 |
13 | %meta{name: "twitter:card", content: "summary"}
14 | %meta{name: "twitter:site", content: "@algolia"}
15 | %meta{name: "twitter:title", content: "Facebook Feed Search"}
16 | %meta{name: "twitter:description", content: "Rethink the way you search your Facebook feed."}
17 | %meta{name: "twitter:image:src", content: asset_url('capture.png')}
18 | %meta{name: "twitter:domain", content: request.host}
19 |
20 | %meta{property: "st:title", content: "Facebook Search" }
21 | %meta{property: "og:url", content: request.url }
22 | %meta{property: "og:site_name", content: 'Facebook Search' }
23 | %meta{property: "og:title", content: 'Facebook Search' }
24 | %meta{property: "og:description", content: "Rethink the way you search your Facebook feed." }
25 | %meta{property: "og:image", content: asset_url('capture.png') }
26 | %meta{property: "og:image:width", content: '662' }
27 | %meta{property: "og:image:height", content: '454' }
28 | %body
29 | = yield
30 |
--------------------------------------------------------------------------------
/app/views/welcome/new.html.haml:
--------------------------------------------------------------------------------
1 | - if current_user || @tag
2 | #signout-link.hidden-xs
3 | - if @tag
4 | = link_to "Try it now!", root_path
5 | - else
6 | = link_to "Sign out", signout_path, method: :delete
7 | #search-form.form
8 | %input.form-control#q{type: 'text', autocomplete: 'off', autocorrect: 'off', spellcheck: 'false', placeholder: 'Search by keywords'}
9 | %small
10 | Realtime Search by
11 | = link_to 'http://www.algolia.com' do
12 | = image_tag "http://www.algolia.com/assets/algolia_white.png"
13 | .container-wrapper
14 | .container
15 | #stats.hidden-xs
16 | #social-links
17 | %a.twitter-follow-button{href: "https://twitter.com/algolia", "data-show-count" => "false", "data-show-screen-name" => "true"}Follow @algolia
18 | %a.twitter-share-button{href: "https://twitter.com/share", "data-url" => root_url, "data-via" => "algolia", 'data-text' => 'Search in your Facebook Feed like a boss.'} Tweet
19 | #hits-wrapper{style: 'display: none'}
20 | .container
21 | .row
22 | #facets.col-lg-2.col-sm-3.hidden-xs
23 | #hits.col-lg-6.col-sm-7.col-xs-12
24 | #branding.col-lg-4.visible-lg
25 | .well
26 | %h2 Build Realtime Search
27 | %p Algolia is a powerful Search API built for developers delivering relevant results in your apps and websites from the first keystroke.
28 | %p.text-center
29 | = link_to 'Check our other demos', 'http://www.algolia.com/demos', class: 'btn btn-danger'
30 | %br
31 | or
32 | %br
33 | = link_to 'Explore our features', 'http://www.algolia.com/features', class: 'btn btn-success'
34 | .row
35 | #next-page.col-lg-6.col-lg-offset-2.col-sm-8.col-sm-offset-3.col-xs-12.text-center{style: "display: none;"}
36 | = image_tag "loading.gif", style: "width: 75px; height: 75px;"
37 | #no-results{style: 'display: none'}
38 | %p.text-center No results are matching your query.
39 | #loading{style: 'display: none'}
40 | %p.text-center
41 | %i.glyphicon.glyphicon-refresh.icon-rotation
42 | We're retrieving your feed, please wait...
43 | %br
44 | %small.text-muted Could take up to 5 minutes depending on your feed activity.
45 |
46 | %script#comments-template{type: 'text/template'}
47 | :plain
48 | {{#total_count}}
49 |
50 |
51 | {{#likes_count}}
52 |
53 | {{ likes_count }}
54 | {{/likes_count}}
55 | {{#comments_count}}
56 |
57 | {{ comments_count }}
58 | {{/comments_count}}
59 |
60 |
61 | {{#actions}}
62 |
{{ name }}
63 | {{/actions}}
64 |
65 |
66 |
67 | {{/total_count}}
68 | {{#comments}}
69 |
88 | {{/comments}}
89 |
90 | %script#status-template{type: 'text/template'}
91 | :plain
92 |
93 |
94 |
95 |
96 |
97 | {{{ story }}}
98 | {{ created_time }}
99 |
100 |
101 | {{#message}}
102 |
103 |
{{{ _highlightResult.message.value }}}
104 |
105 | {{/message}}
106 |
107 | %script#media-template{type: 'text/template'}
108 | :plain
109 |
110 |
111 |
112 |
113 |
114 | {{{ story }}}
115 | {{ created_time }}
116 |
117 |
118 |
119 | {{#message}}
120 |
{{{ _highlightResult.message.value }}}
121 | {{/message}}
122 | {{#name}}
123 |
{{{ _highlightResult.name.value }}}
124 | {{/name}}
125 | {{#link}}
126 |
136 | {{/link}}
137 | {{#description}}
138 |
{{{ _highlightResult.description.value }}}
139 | {{/description}}
140 |
141 |
142 | %script#checkin-template{type: 'text/template'}
143 | :plain
144 |
145 |
146 |
147 |
148 |
149 | {{{ story }}}
150 | {{ created_time }}
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
{{ caption }}
159 |
160 |
161 |
162 | :javascript
163 | $(document).ready(function() {
164 | var algolia = new AlgoliaSearch('#{ENV['ALGOLIA_APPLICATION_ID']}', '#{@secured_api_key}');
165 | algolia.setSecurityTags('#{current_user.uid}');
166 | var $hits = $('#hits');
167 | var $facets = $('#facets');
168 | var $branding = $('#branding');
169 | var $hitsWrapper = $('#hits-wrapper');
170 | var $noResults = $('#no-results');
171 | var $stats = $('#stats');
172 | var $loading = $('#loading');
173 | var $nextPage = $('#next-page');
174 | var $q = $('#q');
175 | window.page = null;
176 | var templates = {
177 | status: Hogan.compile($('#status-template').text()),
178 | photo: Hogan.compile($('#media-template').text()),
179 | link: Hogan.compile($('#media-template').text()),
180 | video: Hogan.compile($('#media-template').text()),
181 | checkin: Hogan.compile($('#checkin-template').text()),
182 | comments: Hogan.compile($('#comments-template').text()),
183 | };
184 | var LABELS = {
185 | 'application.name' : 'Application',
186 | 'type' : 'Type',
187 | 'from.name' : 'Author',
188 | 'story_tags.name' : 'Featuring'
189 | };
190 |
191 | window.helper = new AlgoliaSearchHelper(algolia, 'facebook_#{Rails.env}', {
192 | hitsPerPage: 10,
193 | facets: ['application.name', 'type', 'from.name', 'story_tags.name']
194 | });
195 |
196 | var loading = true;
197 | function searchCallback(success, content) {
198 | if (!success || $q.val() != content.query) {
199 | return;
200 | }
201 |
202 | if (loading) {
203 | $loading.show();
204 | algolia.clearCache();
205 | if (content.hits.length < 2) {
206 | $hitsWrapper.hide();
207 | $noResults.hide();
208 | $stats.hide();
209 | $loading.show();
210 | setTimeout(search, 1000);
211 | return;
212 | }
213 | loading = false;
214 | }
215 | $loading.hide();
216 |
217 | if (content.hits.length === 0) {
218 | if (content.page === 0) {
219 | $hits.empty();
220 | $stats.empty();
221 | $hitsWrapper.hide();
222 | $noResults.show();
223 | } else {
224 | $nextPage.hide();
225 | }
226 | return;
227 | }
228 | $hitsWrapper.show();
229 | $stats.show();
230 | $noResults.hide();
231 |
232 | $stats.html('' + content.nbHits + ' result' + (content.nbHits > 1 ? 's' : '') + ' in ' + content.processingTimeMS + ' ms');
233 |
234 | var html = '';
235 | for (var i = 0; i < content.hits.length; ++i) {
236 | var hit = content.hits[i];
237 | var template = templates[hit.type];
238 | if (!template) {
239 | continue;
240 | }
241 |
242 | if (hit.picture) {
243 | hit.picture = hit.picture.replace(/_s.jpg$/, '_n.jpg');
244 | }
245 |
246 | if (!hit.story) {
247 | hit.story = '' + hit.from.name + '';
248 | }
249 | if (hit.story_tags) {
250 | $.each(hit.story_tags, function() {
251 | hit.story = hit.story.replace(this.name, '' + this.name + '');
252 | });
253 | }
254 |
255 | if (hit.comments) {
256 | for (var j = 0; j < hit.comments.data.length; ++j) {
257 | hit.comments.data[j]._highlightResult = hit._highlightResult.comments.data[j];
258 | if (!hit.comments.data[j].from) {
259 | hit.comments.data[j].from = {
260 | name: 'Anonymous',
261 | id: 'user'
262 | }
263 | }
264 | }
265 | }
266 |
267 | if (hit.comments_count || hit.likes_count) {
268 | hit.total_count = hit.comments_count + hit.likes_count;
269 | }
270 |
271 | html += '' +
272 | template.render(hit) +
273 | templates.comments.render(hit) +
274 | '
';
275 | }
276 | if (content.page === 0) {
277 | $hits.html(html);
278 | } else {
279 | $hits.append(html);
280 | }
281 |
282 | if (content.page == 0) {
283 | html = '';
284 | for (var facet in content.facets) {
285 | var values = [];
286 | for (var f in content.facets[facet]) {
287 | values.push([f, content.facets[facet][f]]);
288 | }
289 | values.sort(function(a, b) { b[1] - a[1] });
290 | html += '' + LABELS[facet] + '
' +
291 | '' +
292 | $.map(values, function(e) { return '- ' + e[0] + ' (' + e[1] + ')'; }).join('') +
293 | '
';
294 | }
295 | $facets.html(html);
296 |
297 | $nextPage.hide();
298 | }
299 |
300 | window.page = null;
301 | $("abbr.timeago").timeago();
302 | }
303 |
304 | window.search = function() {
305 | helper.page = 0;
306 | helper.search($q.val(), searchCallback, {
307 | maxValuesPerFacet: 10,
308 | hitsPerPage: 10,
309 | advancedSyntax: true,
310 | queryType: 'prefixAll',
311 | minWordSizefor1Typo: 4,
312 | minWordSizefor2Typos: 7,
313 | });
314 | };
315 |
316 | $(window).scroll(function () {
317 | if ($(window).scrollTop() >= $(document).height() - $(window).height() - 100) {
318 | if (window.page == null) {
319 | $nextPage.show();
320 | window.page = helper.page + 1;
321 | helper.nextPage();
322 | }
323 | }
324 | });
325 |
326 | $q.on('keyup change', function() {
327 | window.search();
328 | }).focus();
329 |
330 | window.search();
331 | });
332 | - else
333 | #signin-link
334 | %h1.text-center
335 | Facebook Search by
336 | = link_to "http://www.algolia.com" do
337 | = image_tag "http://www.algolia.com/assets/algolia_white.png", height: '60'
338 | %br
339 | %em
340 | %small Search in your Facebook Feed like a boss.
341 | = link_to "Try with your Facebook account", '/auth/facebook', class: 'login'
342 | %p.text-center
343 | %em Your data will be securely indexed, only searchable by You. No spam, ever.
344 |
345 | :javascript
346 | !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
347 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/delayed_job:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
4 | require 'delayed/command'
5 | Delayed::Command.new(ARGV).daemonize
6 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../../config/application', __FILE__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/config/application.example.yml:
--------------------------------------------------------------------------------
1 | # Add account credentials and API keys here.
2 | # See http://railsapps.github.io/rails-environment-variables.html
3 | # This file should be listed in .gitignore to keep your settings secret!
4 | # Each entry sets a local environment variable.
5 | # For example, setting:
6 | # GMAIL_USERNAME: Your_Gmail_Username
7 | # makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
8 |
9 | # Add application configuration variables here, as shown below.
10 | #
11 | OMNIAUTH_PROVIDER_KEY: Your_Provider_Key
12 | OMNIAUTH_PROVIDER_SECRET: Your_Provider_Secret
13 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module FacebookSearch
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17 | # config.time_zone = 'Central Time (US & Canada)'
18 |
19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21 | # config.i18n.default_locale = :de
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/config/deploy.rb:
--------------------------------------------------------------------------------
1 | require "bundler/capistrano"
2 |
3 | set :default_environment, {
4 | 'GIT_SSH' => '/home/prod/ssh-facebook-search.sh'
5 | }
6 |
7 | default_run_options[:pty] = true
8 |
9 | # servers
10 | server 'c3-use-1.algolia.io', :app, :web, :db, :cron, primary: true
11 | server 'c3-use-2.algolia.io', :app, :web
12 | server 'c3-use-3.algolia.io', :app, :web
13 |
14 | # application
15 | set :application, "Facebook Search"
16 | set :deploy_to, "/var/www/facebook-search"
17 | set :user, "prod"
18 | set :use_sudo, false
19 |
20 | # repository
21 | set :local_repository, "."
22 | set :repository, "git@github.com:algolia/facebook-search.git"
23 | set :scm, :git
24 | set :deploy_via, :remote_cache
25 | set :branch, "master"
26 | set :git_shallow_clone, 1
27 |
28 | # keep 5 last releases
29 | set :keep_releases, 5
30 | after "deploy:update", "deploy:cleanup"
31 |
32 | # configuration
33 | desc "Copy in server specific configuration files"
34 | task :copy_shared do
35 | run "cp #{deploy_to}/shared/config/database.yml #{release_path}/config/"
36 | run "cp #{deploy_to}/shared/config/application.yml #{release_path}/config/"
37 | end
38 | before "bundle:install", "copy_shared"
39 |
40 | desc "Restart Thin"
41 | namespace :deploy do
42 | task :restart do
43 | run "cd #{current_path} && bundle exec thin restart -C #{deploy_to}/shared/thin.yml"
44 | end
45 | end
46 |
47 | # ugly workaround for bug https://github.com/capistrano/capistrano/issues/81
48 | before "deploy:assets:precompile", "bundle:install"
49 |
50 | # rvm
51 | require "rvm/capistrano"
52 | set :rvm_ruby_string, 'ruby-2.1.2'
53 |
54 | # delayed job
55 | after "deploy:update", "bluepill:quit", "bluepill:start"
56 | namespace :bluepill do
57 | desc "Stop processes that bluepill is monitoring and quit bluepill"
58 | task :quit, :roles => [:cron] do
59 | run "cd #{current_path} && bundle exec bluepill facebook-search --no-privileged stop"
60 | run "cd #{current_path} && bundle exec bluepill facebook-search --no-privileged quit"
61 | end
62 |
63 | desc "Load bluepill configuration and start it"
64 | task :start, :roles => [:cron] do
65 | run "cd #{current_path} && bundle exec bluepill --no-privileged load /var/www/facebook-search/current/config/production.pill"
66 | end
67 |
68 | desc "Prints bluepills monitored processes statuses"
69 | task :status, :roles => [:cron] do
70 | run "cd #{current_path} && bundle exec bluepill facebook-search --no-privileged status"
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | FacebookSearch::Application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | FacebookSearch::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 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | FacebookSearch::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both thread web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20 | # config.action_dispatch.rack_cache = true
21 |
22 | # Disable Rails's static asset server (Apache or nginx will already do this).
23 | config.serve_static_assets = true
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = :uglifier
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = false
31 |
32 | # Generate digests for assets URLs.
33 | config.assets.digest = true
34 |
35 | # Version of your assets, change this if you want to expire all your assets.
36 | config.assets.version = '1.0'
37 |
38 | # Specifies the header that your server uses for sending files.
39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41 |
42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43 | # config.force_ssl = true
44 |
45 | # Set to :debug to see everything in the log.
46 | config.log_level = :info
47 |
48 | # Prepend all log lines with the following tags.
49 | # config.log_tags = [ :subdomain, :uuid ]
50 |
51 | # Use a different logger for distributed setups.
52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53 |
54 | # Use a different cache store in production.
55 | # config.cache_store = :mem_cache_store
56 |
57 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58 | # config.action_controller.asset_host = "http://assets.example.com"
59 |
60 | # Precompile additional assets.
61 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62 | # config.assets.precompile += %w( search.js )
63 |
64 | # Ignore bad email addresses and do not raise email delivery errors.
65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66 | # config.action_mailer.raise_delivery_errors = false
67 |
68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69 | # the I18n.default_locale when a translation can not be found).
70 | config.i18n.fallbacks = true
71 |
72 | # Send deprecation notices to registered listeners.
73 | config.active_support.deprecation = :notify
74 |
75 | # Disable automatic flushing of the log to improve performance.
76 | # config.autoflush_log = false
77 |
78 | # Use default logging formatter so that PID and timestamp are not suppressed.
79 | config.log_formatter = ::Logger::Formatter.new
80 | end
81 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | FacebookSearch::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 |
--------------------------------------------------------------------------------
/config/initializers/algolia.rb:
--------------------------------------------------------------------------------
1 | Algolia.init application_id: ENV['ALGOLIA_APPLICATION_ID'], api_key: ENV['ALGOLIA_API_KEY']
2 | INDEX = Algolia::Index.new("facebook_#{Rails.env}")
3 | INDEX.set_settings({
4 | attributesToIndex: ['unordered(description)', 'unordered(name)', 'unordered(message)', 'unordered(comments.data.message)', 'unordered(story)'],
5 | attributesForFaceting: ['application.name', 'type', 'story_tags.name', 'from.name'],
6 | customRanking: ['desc(created_time_i)']
7 | })
8 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 | # Mime::Type.register_alias "text/html", :iphone
6 |
--------------------------------------------------------------------------------
/config/initializers/omniauth.rb:
--------------------------------------------------------------------------------
1 | Rails.application.config.middleware.use OmniAuth::Builder do
2 | provider :facebook, ENV['OMNIAUTH_PROVIDER_KEY'], ENV['OMNIAUTH_PROVIDER_SECRET'], scope: 'email,read_stream'
3 | end
4 |
--------------------------------------------------------------------------------
/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 | FacebookSearch::Application.config.secret_key_base = '9d32cdee720a1ef39b35e88df8580dc8006c5666d05954856d231e8fa913d00c59b9dad72b2c5e4e7e21bdca8f4e30caef8a4c5c5d06dc4f0bab6b2cdf891e9f'
13 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | FacebookSearch::Application.config.session_store :cookie_store, key: '_facebook-search_session'
4 |
--------------------------------------------------------------------------------
/config/initializers/simple_form.rb:
--------------------------------------------------------------------------------
1 | # Use this setup block to configure all options available in SimpleForm.
2 | SimpleForm.setup do |config|
3 | # Wrappers are used by the form builder to generate a
4 | # complete input. You can remove any component from the
5 | # wrapper, change the order or even add your own to the
6 | # stack. The options given below are used to wrap the
7 | # whole input.
8 | config.wrappers :default, class: :input,
9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10 | ## Extensions enabled by default
11 | # Any of these extensions can be disabled for a
12 | # given input by passing: `f.input EXTENSION_NAME => false`.
13 | # You can make any of these extensions optional by
14 | # renaming `b.use` to `b.optional`.
15 |
16 | # Determines whether to use HTML5 (:email, :url, ...)
17 | # and required attributes
18 | b.use :html5
19 |
20 | # Calculates placeholders automatically from I18n
21 | # You can also pass a string as f.input placeholder: "Placeholder"
22 | b.use :placeholder
23 |
24 | ## Optional extensions
25 | # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26 | # to the input. If so, they will retrieve the values from the model
27 | # if any exists. If you want to enable the lookup for any of those
28 | # extensions by default, you can change `b.optional` to `b.use`.
29 |
30 | # Calculates maxlength from length validations for string inputs
31 | b.optional :maxlength
32 |
33 | # Calculates pattern from format validations for string inputs
34 | b.optional :pattern
35 |
36 | # Calculates min and max from length validations for numeric inputs
37 | b.optional :min_max
38 |
39 | # Calculates readonly automatically from readonly attributes
40 | b.optional :readonly
41 |
42 | ## Inputs
43 | b.use :label_input
44 | b.use :hint, wrap_with: { tag: :span, class: :hint }
45 | b.use :error, wrap_with: { tag: :span, class: :error }
46 | end
47 |
48 | # The default wrapper to be used by the FormBuilder.
49 | config.default_wrapper = :default
50 |
51 | # Define the way to render check boxes / radio buttons with labels.
52 | # Defaults to :nested for bootstrap config.
53 | # inline: input + label
54 | # nested: label > input
55 | config.boolean_style = :nested
56 |
57 | # Default class for buttons
58 | config.button_class = 'btn'
59 |
60 | # Method used to tidy up errors. Specify any Rails Array method.
61 | # :first lists the first message for each field.
62 | # Use :to_sentence to list all errors for each field.
63 | # config.error_method = :first
64 |
65 | # Default tag used for error notification helper.
66 | config.error_notification_tag = :div
67 |
68 | # CSS class to add for error notification helper.
69 | config.error_notification_class = 'alert alert-error'
70 |
71 | # ID to add for error notification helper.
72 | # config.error_notification_id = nil
73 |
74 | # Series of attempts to detect a default label method for collection.
75 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76 |
77 | # Series of attempts to detect a default value method for collection.
78 | # config.collection_value_methods = [ :id, :to_s ]
79 |
80 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81 | # config.collection_wrapper_tag = nil
82 |
83 | # You can define the class to use on all collection wrappers. Defaulting to none.
84 | # config.collection_wrapper_class = nil
85 |
86 | # You can wrap each item in a collection of radio/check boxes with a tag,
87 | # defaulting to :span. Please note that when using :boolean_style = :nested,
88 | # SimpleForm will force this option to be a label.
89 | # config.item_wrapper_tag = :span
90 |
91 | # You can define a class to use in all item wrappers. Defaulting to none.
92 | # config.item_wrapper_class = nil
93 |
94 | # How the label text should be generated altogether with the required text.
95 | # config.label_text = lambda { |label, required| "#{required} #{label}" }
96 |
97 | # You can define the class to use on all labels. Default is nil.
98 | config.label_class = 'control-label'
99 |
100 | # You can define the class to use on all forms. Default is simple_form.
101 | # config.form_class = :simple_form
102 |
103 | # You can define which elements should obtain additional classes
104 | # config.generate_additional_classes_for = [:wrapper, :label, :input]
105 |
106 | # Whether attributes are required by default (or not). Default is true.
107 | # config.required_by_default = true
108 |
109 | # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110 | # These validations are enabled in SimpleForm's internal config but disabled by default
111 | # in this configuration, which is recommended due to some quirks from different browsers.
112 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113 | # change this configuration to true.
114 | config.browser_validations = false
115 |
116 | # Collection of methods to detect if a file type was given.
117 | # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118 |
119 | # Custom mappings for input types. This should be a hash containing a regexp
120 | # to match as key, and the input type that will be used when the field name
121 | # matches the regexp as value.
122 | # config.input_mappings = { /count/ => :integer }
123 |
124 | # Custom wrappers for input types. This should be a hash containing an input
125 | # type as key and the wrapper that will be used for all inputs with specified type.
126 | # config.wrapper_mappings = { string: :prepend }
127 |
128 | # Default priority for time_zone inputs.
129 | # config.time_zone_priority = nil
130 |
131 | # Default priority for country inputs.
132 | # config.country_priority = nil
133 |
134 | # When false, do not use translations for labels.
135 | # config.translate_labels = true
136 |
137 | # Automatically discover new inputs in Rails' autoload path.
138 | # config.inputs_discovery = true
139 |
140 | # Cache SimpleForm inputs discovery
141 | # config.cache_discovery = !Rails.env.development?
142 |
143 | # Default class for inputs
144 | # config.input_class = nil
145 | end
146 |
--------------------------------------------------------------------------------
/config/initializers/simple_form_bootstrap.rb:
--------------------------------------------------------------------------------
1 | # Use this setup block to configure all options available in SimpleForm.
2 | SimpleForm.setup do |config|
3 | config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
4 | b.use :html5
5 | b.use :placeholder
6 | b.use :label
7 | b.wrapper tag: 'div', class: 'controls' do |ba|
8 | ba.use :input
9 | ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
10 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
11 | end
12 | end
13 |
14 | config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
15 | b.use :html5
16 | b.use :placeholder
17 | b.use :label
18 | b.wrapper tag: 'div', class: 'controls' do |input|
19 | input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
20 | prepend.use :input
21 | end
22 | input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
23 | input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
24 | end
25 | end
26 |
27 | config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
28 | b.use :html5
29 | b.use :placeholder
30 | b.use :label
31 | b.wrapper tag: 'div', class: 'controls' do |input|
32 | input.wrapper tag: 'div', class: 'input-append' do |append|
33 | append.use :input
34 | end
35 | input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
36 | input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
37 | end
38 | end
39 |
40 | # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
41 | # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
42 | # to learn about the different styles for forms and inputs,
43 | # buttons and other elements.
44 | config.default_wrapper = :bootstrap
45 | end
46 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/config/locales/simple_form.en.yml:
--------------------------------------------------------------------------------
1 | en:
2 | simple_form:
3 | "yes": 'Yes'
4 | "no": 'No'
5 | required:
6 | text: 'required'
7 | mark: '*'
8 | # You can uncomment the line below if you need to overwrite the whole required html.
9 | # When using html, text and mark won't be used.
10 | # html: '*'
11 | error_notification:
12 | default_message: "Please review the problems below:"
13 | # Labels and hints examples
14 | # labels:
15 | # defaults:
16 | # password: 'Password'
17 | # user:
18 | # new:
19 | # email: 'E-mail to sign in.'
20 | # edit:
21 | # email: 'E-mail.'
22 | # hints:
23 | # defaults:
24 | # username: 'User name to sign in.'
25 | # password: 'No special characters, please.'
26 |
27 |
--------------------------------------------------------------------------------
/config/production.pill:
--------------------------------------------------------------------------------
1 | Bluepill.application("facebook-search", :log_file => "/var/www/facebook-search/current/log/bluepill.log") do |app|
2 | (1..4).each do |i|
3 | app.process("facebook-delayed_job.#{i}") do |process|
4 | process.working_dir = "/var/www/facebook-search/current"
5 | process.environment = { 'RAILS_ENV' => 'production' }
6 |
7 | process.start_grace_time = 30.seconds
8 | process.stop_grace_time = 30.seconds
9 | process.restart_grace_time = 30.seconds
10 |
11 | process.start_command = "./bin/delayed_job start -i #{i}"
12 | process.stop_command = "./bin/delayed_job stop -i #{i}"
13 |
14 | process.pid_file = "/var/www/facebook-search/shared/pids/delayed_job.#{i}.pid"
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | FacebookSearch::Application.routes.draw do
2 | get "/auth/:provider/callback" => "sessions#create"
3 | get "/auth/failure", to: redirect('/')
4 | delete "/signout" => "sessions#destroy", as: :signout
5 | root "welcome#new"
6 | end
7 |
--------------------------------------------------------------------------------
/db/migrate/20140329054556_create_users.rb:
--------------------------------------------------------------------------------
1 | class CreateUsers < ActiveRecord::Migration
2 | def change
3 | create_table :users do |t|
4 | t.string :name
5 | t.string :email
6 | t.string :provider
7 | t.string :uid
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/db/migrate/20140329061757_create_delayed_jobs.rb:
--------------------------------------------------------------------------------
1 | class CreateDelayedJobs < ActiveRecord::Migration
2 | def self.up
3 | create_table :delayed_jobs, :force => true do |table|
4 | table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
5 | table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
6 | table.text :handler, :null => false # YAML-encoded string of the object that will do work
7 | table.text :last_error # reason for last failure (See Note below)
8 | table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
9 | table.datetime :locked_at # Set when a client is working on this object
10 | table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
11 | table.string :locked_by # Who is working on this object (if locked)
12 | table.string :queue # The name of the queue this job is in
13 | table.timestamps
14 | end
15 |
16 | add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
17 | end
18 |
19 | def self.down
20 | drop_table :delayed_jobs
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/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: 20140329061757) do
15 |
16 | create_table "delayed_jobs", force: true do |t|
17 | t.integer "priority", default: 0, null: false
18 | t.integer "attempts", default: 0, null: false
19 | t.text "handler", null: false
20 | t.text "last_error"
21 | t.datetime "run_at"
22 | t.datetime "locked_at"
23 | t.datetime "failed_at"
24 | t.string "locked_by"
25 | t.string "queue"
26 | t.datetime "created_at"
27 | t.datetime "updated_at"
28 | end
29 |
30 | add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority"
31 |
32 | create_table "users", force: true do |t|
33 | t.string "name"
34 | t.string "email"
35 | t.string "provider"
36 | t.string "uid"
37 | t.datetime "created_at"
38 | t.datetime "updated_at"
39 | end
40 |
41 | end
42 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/db/seeds.rb
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/lib/tasks/.keep
--------------------------------------------------------------------------------
/lib/templates/haml/scaffold/_form.html.haml:
--------------------------------------------------------------------------------
1 | = simple_form_for(@<%= singular_table_name %>) do |f|
2 | = f.error_notification
3 |
4 | .form-inputs
5 | <%- attributes.each do |attribute| -%>
6 | = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
7 | <%- end -%>
8 |
9 | .form-actions
10 | = f.button :submit
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/public/favicon.ico
--------------------------------------------------------------------------------
/public/humans.txt:
--------------------------------------------------------------------------------
1 | /* the humans responsible & colophon */
2 | /* humanstxt.org */
3 |
4 |
5 | /* TEAM */
6 | :
7 | Site:
8 | Twitter:
9 | Location:
10 |
11 | /* THANKS */
12 | Daniel Kehoe (@rails_apps) for the RailsApps project
13 |
14 | /* SITE */
15 | Standards: HTML5, CSS3
16 | Components: jQuery
17 | Software: Ruby on Rails
18 |
19 | /* GENERATED BY */
20 | RailsApps application template: http://railsapps.github.io/
21 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/controllers/.keep
--------------------------------------------------------------------------------
/test/controllers/welcome_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class WelcomeControllerTest < ActionController::TestCase
4 | test "should get new" do
5 | get :new
6 | assert_response :success
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/test/factories/users.rb:
--------------------------------------------------------------------------------
1 | # Read about factories at https://github.com/thoughtbot/factory_girl
2 |
3 | FactoryGirl.define do
4 | factory :user do
5 | name "MyString"
6 | email "MyString"
7 | provider "MyString"
8 | uid "MyString"
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/helpers/.keep
--------------------------------------------------------------------------------
/test/helpers/welcome_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class WelcomeHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/integration/.keep
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/test/models/.keep
--------------------------------------------------------------------------------
/test/models/user_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class UserTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["RAILS_ENV"] ||= "test"
2 | require File.expand_path('../../config/environment', __FILE__)
3 | require 'rails/test_help'
4 |
5 | class ActiveSupport::TestCase
6 | ActiveRecord::Migration.check_pending!
7 |
8 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9 | #
10 | # Note: You'll currently still have to declare fixtures explicitly in integration tests
11 | # -- they do not yet inherit this setting
12 | fixtures :all
13 |
14 | # Add more helper methods to be used by all tests here...
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algolia/facebook-search/71975c2f257651b8a52d21887a00c7b1e42e17e5/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
76 | {{ from.name }} 77 | {{{ _highlightResult.message.value }}} 78 | {{#like_count}} 79 | 80 | {{ like_count }} 81 | {{/like_count}} 82 | {{ created_time }} 83 |
84 | 85 |