class VotesController < ApplicationController
def create
@vote = Vote.find_or_initialize_by_submitted_by_ip(request.remote_ip)
@vote.update_attributes(params[:vote]) if !@vote.has_user?(session[:user_id])
render json: @vote
end
end
class Vote < ActiveRecord::Base
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
| Blocks.SortPipePlugin = Em.PipePlugin.extend | |
| # Define a list of sorting properties | |
| observes: Em.computed.alias('sortProperties') | |
| # The sorting function to use | |
| sortFunction: Em.compare | |
| # Our sort routine | |
| process: (inputArr) -> | |
| # DS.ManyArray does not support sort() |
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
| Extra content at the end of the document. | |
| Location: '/VirtualBox VMs/GitHubEnterprise/GitHubEnterprise.vbox', line 16563 (0), column 61. | |
| /build/buildd/virtualbox-4.1.12-dfsg/src/VBox/Main/src-server/MachineImpl.cpp[707] (nsresult Machine::registeredInit()). | |
| Result Code: NS_ERROR_FAILURE (0x80004005) | |
| Component: VirtualBox | |
| Interface: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66} |
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 '../../test_helper.coffee' | |
| describe 'ArrayPipeline', -> | |
| describe '#_setupPlugin()', -> | |
| it 'should instantiate a plugin from a constant', -> | |
| pipeline = Em.ArrayProxy.createWithMixins(Em.ArrayPipelineMixin,{}) | |
| pipeline.get('_processors.length').should.equal(0) | |
| pipeline._setupPlugin(Em.PipePlugin) |
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
| App.Comment = DS.Model.extend | |
| parentComment: DS.belongsTo("App.Comment", inverse: 'childComments') | |
| childComments: DS.hasMany("App.Comment", inverse: 'parentComment') |
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
| App.BookIndexController = Ember.ArrayController.extend | |
| content: [] # array of books | |
| proxies: {} # proxy cache for books | |
| # Creates and caches a proxy that will wrap around our book | |
| createProxy: (book, id) -> | |
| @proxies[id] = BookProxy.create | |
| content: book | |
| controller: this |
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
| Ember.ArrayPipelinePlugin = Ember.Object.extend | |
| # | |
| # Public | |
| # | |
| # Define a set of properties you would like to observe on the array for | |
| # reprocessing. | |
| # | |
| # If another plugin earlier in the pipeline observes the same property, | |
| # then this plugin will wait to process until the other plugin in the pipeline |
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 File | |
| def to_str | |
| path | |
| end | |
| end | |
| class Hamlbars::Converter | |
| def self.process_directory(directory) | |
| dir = Dir.open(directory) |
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 WebSocket | |
| constructor: (url) -> | |
| cordova.exec (-> return true), (-> return false), "WebSocketPlugin", "createSocket", [url] | |
| cordova.exec @_onerror, (->), "WebSocketPlugin", "registerCallback", ["onerror"] | |
| cordova.exec @_onopen, (->), "WebSocketPlugin", "registerCallback", ["onopen"] | |
| cordova.exec @_onclose, (->), "WebSocketPlugin", "registerCallback", ["onclose"] | |
| cordova.exec @_onmessage, (->), "WebSocketPlugin", "registerCallback", ["onmessage"] | |
| send: (message) -> | |
| cordova.exec (-> return true), (-> return false), "WebSocketPlugin", "send", [message] |
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
| addImages: (files) -> | |
| formData = new FormData() | |
| # Attach block id | |
| formData.append "attachments[book_id]", @get('content.id') | |
| # Loop through the FileList and render image files as thumbnails. | |
| for file in files | |
| # Only process image files. | |
| if file.type.match("image.*") |