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
| Apprennet.Views.MyThingView = Backbone.View.extend({ | |
| // This will initialize backbone/templates/sub_dir/my_thing.hbs into a template function | |
| template: HandlebarsTemplates['backbone/templates/sub_dir/my_thing'], | |
| render: function() { | |
| // Call the template function here with an object that declares the template vars. | |
| this.$el.html(template({name: "My Thing Name"})); | |
| // So here, when compiled, the template will replace {{name}} with "My Thing Name". | |
| } |
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
| <script> | |
| var apiKey = '<%= Rails.application.config.tokbox_api_key %>'; | |
| var sessionId = '<%= session_id %>'; | |
| var token = '<%= token %>'; | |
| var session = OT.initSession(apiKey, sessionId); | |
| session.on("streamCreated", function(event) { | |
| session.subscribe(event.stream); | |
| }); |
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
| {:id=>"f62ebaea-2b94-48c6-a714-b3d65e97cd27", :status=>"available", :name=>nil, :status_message=>"", :session_id=>"2_MX4xMDI2MDE0Mn5-VHVlIEp1biAwMyAwNjozOTo0OCBQRFQgMjAxNH4wLjk5NDUyMjR-fg", :partner_id=>10260142, :created_at=>2014-06-03 09:48:11 -0400, :size=>35671, :duration=>30, :mode=>"automatic", :updated_at=>1401803322000, :url=>"http://tokbox.com.archive2.s3.amazonaws.com/10260142%2Ff62ebaea-2b94-48c6-a714-b3d65e97cd27%2Farchive.mp4?Expires=1401803994&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=hWackDhYtNvG6Rkuml8AC0nhz9w%3D"} |
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
| proxy_vm: | |
| name: "apprennet" | |
| memory: 4048 | |
| cpus: 4 | |
| services: | |
| redis: | |
| docker_config: | |
| image: dockerfile/redis | |
| ports: | |
| - 6379:6379 |
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 'mechanize' | |
| require 'open-uri' | |
| url = 'http://33.33.33.11/nicoleandjason.us/links' | |
| agent = Mechanize.new | |
| page = agent.get(url) | |
| page.links.each_with_index do |link, index| | |
| id = rand(100) * index |
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
| var Person = function(firstName, lastName) { | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| } | |
| Person.prototype.fullName = function() { | |
| return this.firstName + " " + this.lastName; | |
| } | |
| var Worker = function(firstName, lastName, title) { |
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
| @mm = MiniMeet.find('5399f026dc8c101cd800014e') | |
| first_count = @mm.participants.count | |
| @mm.participants.each do |participant| | |
| submission = @mm.get_user_submission(participant.id) | |
| @mm.review_module.get_ranking_and_score(submission) | |
| end | |
| puts "\n\n\nBefore the loop, @mm.participants is: #{first_count}" | |
| puts "After the loop, @mm.participants is: #{@mm.participants.count}\n\n\n" |
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 ArticlesController < ApplicationController | |
| before_action :set_article, only: [:show, :edit, :update, :destroy] | |
| def index | |
| @articles = Article.all | |
| @articles_category = Article.order(:category) | |
| @users = User.all | |
| end | |
| def show |
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 Post < ActiveRecord::Base | |
| # We're passing in a lambda as the second argument to `scope`. | |
| scope :recent, lambda { where(created_at: (Time.now - 1.hour)..Time.now) } | |
| # This is important because if it's not passed in as a lambda, | |
| # Time.now would be evaluated at app load time rather than execution time, | |
| # which is almost certainly not what we mean here. | |
| # | |
| # Passing it in as a lambda ensures that Time.now is the time at which Post.recent is called | |
| # in your app code. |