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 EventsController < ApplicationController | |
before_filter :authenticate_user!, :except => [:show, :index, :api_by_name] | |
def index | |
@events = Event.all | |
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
<div id="user_nav"> | |
<% if user_signed_in? %> | |
Signed in as <%= current_user.email %>. Not you? | |
<%= link_to "Sign out", destroy_user_session_path, :method => :delete %> | |
<% else %> | |
<%= link_to "Sign up", new_user_registration_path %> or <%= link_to "sign in", new_user_session_path %> | |
<% end %> | |
</div> |
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
<div class="container"> | |
<h2 class="form-signin-heading">Sign in</h2> | |
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> | |
<div><%= f.label :email %><br /> | |
<%= f.email_field :email, :autofocus => true %></div> | |
### | |
<%= render "devise/shared/links" %> | |
</div> |
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
<% if current_user.try(:admin?) %> | |
<%= link_to 'Edit', edit_event_path(event) %> | |
<%= link_to 'Destroy', event, confirm: 'Are you sure?', method: :delete %> | |
<% 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
class AddAdminToUsers < ActiveRecord::Migration | |
def change | |
add_column :users, :admin, :boolean, :default => false | |
end | |
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
def destroy(mode=:soft) | |
run_callbacks :destroy do | |
if mode == :hard | |
super() | |
else | |
update(deleted_at: Time.zone.now) | |
end | |
end | |
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
def avc_settings | |
config = { | |
'connectionstring' => 'localhost:3000', | |
'languagefile' => 'translations/en.xml', | |
'qualityurl' => '', | |
'maxRecordingTime' => 86400, | |
"useUserId" => "true", | |
'userId' => '', | |
'outgoingBuffer' => 0, | |
'playbackBuffer' => 1, |
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 SubmissionUploadForm | |
constructor: (form) -> | |
return if form.length == 0 # break unless form is present | |
@form = $(form) | |
@fileSelect = @form.find("#fileSelect") | |
@fileUpload = @form.find("#fileUpload") | |
@filesQueue = [] | |
@setEvents() |
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
// Cape Fear Leitmotif | |
// 1. Using Safari, go to http://stuartmemo.com/synth/ | |
// 2. Enable Web Inspector - To do so, enable the “Show Develop menu in menu bar” setting found in Safari's preferences | |
// under the Advanced pane. You can then access Web Inspector through the Develop menu that appears in the menubar, | |
// or by pressing Command-Option-I. (see http://ow.ly/Y2Ae302Zn1C) | |
// 3. Open console (press Command-Option-I) | |
// 4. Copy and paste the code below | |
// 5. Press enter |
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
# customizing as_json with standalone JBuilder DSL | |
def as_json(options={}) | |
Jbuilder.encode do |json| | |
json.(self, :incident_address, :borough, :latitude, :longitude) | |
json.upvotes(self.upvotes.count) | |
json.upvoted_by(self.upvotes.pluck(:user_id)) | |
end | |
end |