-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c0cc97e
Showing
51 changed files
with
911 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
.DS_Store | ||
pusher.rb | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/*.log | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pusher_presence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rails', '4.0.1' | ||
|
||
gem 'sqlite3' | ||
gem 'sass-rails', '~> 4.0.0' | ||
gem 'uglifier', '>= 1.3.0' | ||
gem 'coffee-rails', '~> 4.0.0' | ||
gem 'jquery-rails' | ||
gem 'turbolinks' | ||
gem 'jbuilder', '~> 1.2' | ||
gem 'pusher' | ||
|
||
group :doc do | ||
# bundle exec rake doc:rails generates the API under doc/api. | ||
gem 'sdoc', require: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actionmailer (4.0.1) | ||
actionpack (= 4.0.1) | ||
mail (~> 2.5.4) | ||
actionpack (4.0.1) | ||
activesupport (= 4.0.1) | ||
builder (~> 3.1.0) | ||
erubis (~> 2.7.0) | ||
rack (~> 1.5.2) | ||
rack-test (~> 0.6.2) | ||
activemodel (4.0.1) | ||
activesupport (= 4.0.1) | ||
builder (~> 3.1.0) | ||
activerecord (4.0.1) | ||
activemodel (= 4.0.1) | ||
activerecord-deprecated_finders (~> 1.0.2) | ||
activesupport (= 4.0.1) | ||
arel (~> 4.0.0) | ||
activerecord-deprecated_finders (1.0.3) | ||
activesupport (4.0.1) | ||
i18n (~> 0.6, >= 0.6.4) | ||
minitest (~> 4.2) | ||
multi_json (~> 1.3) | ||
thread_safe (~> 0.1) | ||
tzinfo (~> 0.3.37) | ||
arel (4.0.1) | ||
atomic (1.1.14) | ||
builder (3.1.4) | ||
coffee-rails (4.0.1) | ||
coffee-script (>= 2.2.0) | ||
railties (>= 4.0.0, < 5.0) | ||
coffee-script (2.2.0) | ||
coffee-script-source | ||
execjs | ||
coffee-script-source (1.6.3) | ||
erubis (2.7.0) | ||
execjs (2.0.2) | ||
hike (1.2.3) | ||
httpclient (2.3.4.1) | ||
i18n (0.6.9) | ||
jbuilder (1.5.3) | ||
activesupport (>= 3.0.0) | ||
multi_json (>= 1.2.0) | ||
jquery-rails (3.0.4) | ||
railties (>= 3.0, < 5.0) | ||
thor (>= 0.14, < 2.0) | ||
json (1.8.1) | ||
mail (2.5.4) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.25.1) | ||
minitest (4.7.5) | ||
multi_json (1.8.2) | ||
polyglot (0.3.3) | ||
pusher (0.12.0) | ||
httpclient (~> 2.3.0) | ||
multi_json (~> 1.0) | ||
signature (~> 0.1.6) | ||
rack (1.5.2) | ||
rack-test (0.6.2) | ||
rack (>= 1.0) | ||
rails (4.0.1) | ||
actionmailer (= 4.0.1) | ||
actionpack (= 4.0.1) | ||
activerecord (= 4.0.1) | ||
activesupport (= 4.0.1) | ||
bundler (>= 1.3.0, < 2.0) | ||
railties (= 4.0.1) | ||
sprockets-rails (~> 2.0.0) | ||
railties (4.0.1) | ||
actionpack (= 4.0.1) | ||
activesupport (= 4.0.1) | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
rake (10.1.0) | ||
rdoc (3.12.2) | ||
json (~> 1.4) | ||
sass (3.2.12) | ||
sass-rails (4.0.1) | ||
railties (>= 4.0.0, < 5.0) | ||
sass (>= 3.1.10) | ||
sprockets-rails (~> 2.0.0) | ||
sdoc (0.3.20) | ||
json (>= 1.1.3) | ||
rdoc (~> 3.10) | ||
signature (0.1.7) | ||
sprockets (2.10.1) | ||
hike (~> 1.2) | ||
multi_json (~> 1.0) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
sprockets-rails (2.0.1) | ||
actionpack (>= 3.0) | ||
activesupport (>= 3.0) | ||
sprockets (~> 2.8) | ||
sqlite3 (1.3.8) | ||
thor (0.18.1) | ||
thread_safe (0.1.3) | ||
atomic | ||
tilt (1.4.1) | ||
treetop (1.4.15) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
turbolinks (1.3.1) | ||
coffee-rails | ||
tzinfo (0.3.38) | ||
uglifier (2.3.2) | ||
execjs (>= 0.3.0) | ||
json (>= 1.8.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
coffee-rails (~> 4.0.0) | ||
jbuilder (~> 1.2) | ||
jquery-rails | ||
pusher | ||
rails (= 4.0.1) | ||
sass-rails (~> 4.0.0) | ||
sdoc | ||
sqlite3 | ||
turbolinks | ||
uglifier (>= 1.3.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require File.expand_path('../config/application', __FILE__) | ||
|
||
PusherPresence::Application.load_tasks |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. | ||
// | ||
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require turbolinks | ||
//= require_tree . | ||
//= require pusher.min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the top of the | ||
* compiled file, but it's generally better to create a new file per style scope. | ||
* | ||
*= require_self | ||
*= require_tree . | ||
*/ | ||
#chat_widget_container{padding:20px 20px 5px 20px; background-color:#F2F2F2; border:5px solid #AFAFAF; | ||
border-bottom:0px; width:333px; font-size:11px; font-family:"Lucida Grande",Arial,Helvetica,sans-serif; | ||
position:fixed; bottom:0px; right:20px} | ||
|
||
#chat_widget_login{width:333px; text-align:center; height:166px; margin-top:80px} | ||
|
||
#chat_widget_messages_container{float:left; width:200px; border:1px solid #DDD; height:200px; overflow:auto; | ||
padding:5px; background-color:#FFF; position:relative} | ||
|
||
#chat_widget_messages{overflow-x:hidden; overflow-y:auto; position:absolute; bottom:0px} | ||
|
||
#chat_widget_online{width:100px; height:210px; float:left; padding:0px 10px; border:1px solid #DDD; | ||
border-left:0px; background-color:#FFF; overflow: auto;} | ||
|
||
#chat_widget_online_list{list-style:none; padding:0px} | ||
|
||
#chat_widget_online_list >li{margin-left:0px} | ||
|
||
#chat_widget_input_container{margin-top:10px; text-align:left} | ||
|
||
#chat_widget_input{width:260px; margin-right:10px; border:1px solid #DDD; padding:2px 5px} | ||
|
||
.clear{clear:both} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ApplicationController < ActionController::Base | ||
# Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | ||
protect_from_forgery with: :null_session | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class HomeController < ApplicationController | ||
def index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class PusherController < ApplicationController | ||
def auth | ||
user_id = (1..10).to_a.shuffle.first | ||
response = Pusher[params[:channel_name]].authenticate(params[:socket_id], { | ||
:user_id => user_id, | ||
:user_info => { | ||
:name => "User #{user_id}" | ||
} | ||
}) | ||
render :json => response | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ApplicationHelper | ||
end |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<div id="chat_widget_container"> | ||
<div id="chat_widget_main_container"> | ||
<div id="chat_widget_messages_container"> | ||
<div id="chat_widget_messages"> | ||
chat messages go here | ||
</div> | ||
</div> | ||
<div id="chat_widget_online"> | ||
<p>Who's Online (<span id="chat_widget_counter">0</span>)</p> | ||
<ul id="chat_widget_online_list"> | ||
<li>online users go here</li> | ||
</ul> | ||
</div> | ||
<div class="clear"></div> | ||
<div id="chat_widget_input_container"> | ||
<form method="post" id="chat_widget_form"> | ||
<input type="text" id="chat_widget_input" /> | ||
<input type="submit" value="Chat" id="chat_widget_button" /> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<%= javascript_tag do %> | ||
console.log("hey mae"); | ||
pusher = new Pusher('f56593b7930f439b27e6'); | ||
nettuts_channel = pusher.subscribe('presence-nettuts'); //join the presence-nettuts channel | ||
|
||
nettuts_channel.bind('pusher:subscription_succeeded', function(members) { | ||
var whosonline_html = ''; | ||
members.each(function(member) { | ||
whosonline_html += '<li class="chat_widget_member" id="chat_widget_member_' + | ||
member.id + '">' + member.info.name + '</li>'; | ||
}); | ||
$('#chat_widget_online_list').html(whosonline_html); | ||
}); | ||
|
||
nettuts_channel.bind('pusher:member_added', function(member) { | ||
$('#chat_widget_online_list').append('<li class="chat_widget_member" ' + | ||
'id="chat_widget_member_' + member.id + '">' + member.info.name + '</li>'); | ||
}); | ||
|
||
nettuts_channel.bind('pusher:member_removed', function(member) { | ||
console.log("here"); | ||
$('#chat_widget_member_' + member.id).remove(); | ||
}); | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>PusherPresence</title> | ||
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> | ||
<%= javascript_include_tag "application", "data-turbolinks-track" => true %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
|
||
<%= yield %> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env ruby | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | ||
load Gem.bin_path('bundler', 'bundle') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
APP_PATH = File.expand_path('../../config/application', __FILE__) | ||
require_relative '../config/boot' | ||
require 'rails/commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
require_relative '../config/boot' | ||
require 'rake' | ||
Rake.application.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is used by Rack-based servers to start the application. | ||
|
||
require ::File.expand_path('../config/environment', __FILE__) | ||
run Rails.application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require File.expand_path('../boot', __FILE__) | ||
|
||
# Pick the frameworks you want: | ||
require "active_record/railtie" | ||
require "action_controller/railtie" | ||
require "action_mailer/railtie" | ||
require "sprockets/railtie" | ||
# require "rails/test_unit/railtie" | ||
|
||
# Require the gems listed in Gemfile, including any gems | ||
# you've limited to :test, :development, or :production. | ||
Bundler.require(:default, Rails.env) | ||
|
||
module PusherPresence | ||
class Application < Rails::Application | ||
# Settings in config/environments/* take precedence over those specified here. | ||
# Application configuration should go into files in config/initializers | ||
# -- all .rb files in that directory are automatically loaded. | ||
|
||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | ||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | ||
# config.time_zone = 'Central Time (US & Canada)' | ||
|
||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | ||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | ||
# config.i18n.default_locale = :de | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Set up gems listed in the Gemfile. | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | ||
|
||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem 'sqlite3' | ||
development: | ||
adapter: sqlite3 | ||
database: db/development.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
adapter: sqlite3 | ||
database: db/test.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
production: | ||
adapter: sqlite3 | ||
database: db/production.sqlite3 | ||
pool: 5 | ||
timeout: 5000 |
Oops, something went wrong.