// old
const helloWorld = React.createClass({
render() {},
});
// new
class HelloWorld extends React.Component {
render() {}Anytime you go out for a meal and the hostess informs you that there is a wait and you agree to be added to a waitlist, you are being put into a queue. A queue is at it's core nothing more than a line. In fact, in the UK they call waiting in line queueing.
Our queue when you arrive -
[
{"name": "Bob"},
{"name": "Karen"}
]
This file contains hidden or 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
| 'use strict'; | |
| module.exports = function isUndefined(obj) { | |
| return typeof obj === 'undefined'; | |
| } |
Assumptions: The application already exists. You have two models article.rb and comment.rb. Articles have two attributes, title and text. Comments have two attributes, text and article_id. See these instructions if you need help getting started.
Assuming that you are nesting your :comments resources inside of :articles, mount ActionCable and make sure you have a root.
config/routes.rb
Rails.application.routes.draw do
This file contains hidden or 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
| // Testing API routes | |
| module.exports = vows.describe('Feature > SubFeature').addBatch(setupBatch).addBatch({ | |
| 'GET /some/specific/url?q=something by User One > Testing SubFeature.0': { | |
| topic: function(){ | |
| request.get({ | |
| headers: { | |
| authorization: someHelperMethod('userone') | |
| } |
This file contains hidden or 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
| # wines_controller.rb | |
| def import | |
| file = params[:file] | |
| user = current_user.id | |
| UploadCsvJob.new.async.perform(file, user) | |
| redirect_to root_path, notice: "Your wines are being imported! Check your wine list for updates." | |
| end | |
| # wine.rb |
This file contains hidden or 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
| class VideosController < ApplicationController | |
| include Rails.application.routes.url_helpers | |
| def show | |
| @video = Video.find(params[:id]) | |
| @original_video = @video.panda_video | |
| @h264e = @original_video.encodings['h264'] | |
| end |
This file contains hidden or 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 'rails_helper' | |
| RSpec.describe Recipe, :type => :model do | |
| context 'validations' do | |
| it 'should validate name' do | |
| recipe = FactoryGirl.build_stubbed(:recipe) | |
| expect(recipe).to be_valid |
This file contains hidden or 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
| class AuthController < ApplicationController | |
| def facebook | |
| @user = User.find_or_create_from_auth_hash(auth_hash) | |
| self.current_user = @user | |
| end | |
| def facebook_callback | |
| current_user.set_facebook_token(auth_hash.credentials.token) | |
| redirect_to wishlists_path, notice: "Facebook hooked up!" |