First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
puts ENV["GEM_HOME"] | |
require 'mongoid' | |
require 'mongoid/version' | |
puts "Using Mongoid: #{Mongoid::VERSION}" | |
Mongoid.master = Mongo::Connection.new.db("mongoid_playground") | |
class Animal |
This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo
- Install Gems with Bundler with
bundle install
- Define your guards with
mate Guardfile
- Initialize Jasmine with
bundle exec jasmine init
- Configure Jasmine with
mate spec/support/yasmine.ym
- Start Guard with
bundle exec guard
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
# A list of possible usernames to reserve to avoid | |
# vanity URL collision with resource paths | |
# It is a merged list of the recommendations from this Quora discussion: | |
# http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features | |
# Country TLDs found here: | |
# http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains | |
# Languages found here: |
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
# config/initializers/active_model_serializers.rb | |
Mongoid::Document.send(:include, ActiveModel::SerializerSupport) | |
Mongoid::Criteria.delegate(:active_model_serializer, :to => :to_a) |
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
# This script is designed to be used with Ruby on Rails' new project generator: | |
# | |
# rails new my_app -m thisfile -T -O | |
# | |
# For more information about the template API, please see the following Rails | |
# guide: | |
# | |
# http://edgeguides.rubyonrails.org/rails_application_templates.html | |
# create rvmrc 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
module SystemHook | |
private | |
def system(*args) | |
super.tap do |result| | |
puts "system(#{args.join(', ')}) returned #{result.inspect}" | |
end | |
end | |
end | |
class Object |
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
# Support for Rspec / Capybara subdomain integration testing | |
# Make sure this file is required by spec_helper.rb | |
# (e.g. save as spec/support/subdomains.rb) | |
def switch_to_subdomain(subdomain) | |
# lvh.me always resolves to 127.0.0.1 | |
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me" | |
Capybara.app_host = "http://#{hostname}" | |
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
#Let's extract some registration logic out of our controllers into a UserRegistration class. | |
#This class should take user_params as arguments to its constructor, | |
#which are used to initialize a new User (not create). | |
#This newly initialized user should be available as an attr_reader. | |
#You'll also want to move the valid_background_check? method | |
#into this new class as a private method, we'll use this later to finish creating the User. | |
class UsersController < ApplicationController | |
def create | |
@user = User.new(user_params) |
OlderNewer