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="chatboxinput"> | |
| <%= form_for([@conversation, @message], :url => conversation_messages_path(@conversation, @message, format: 'js'), :remote => true, :html => {id: "conversation_form_#{@conversation.id}"}) do |f| %> | |
| <%= f.text_area :body, class: "chatboxtextarea", "data-cid" => @conversation.id %> | |
| <%= hidden_field_tag :authenticity_token, form_authenticity_token %> | |
| <% 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
| class Challenge < AR::Base | |
| belongs_to :category | |
| has_many :participations | |
| has_many :participants, through: :participations | |
| 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 form_for_login(&block) | |
| form_for(resource, | |
| as: resource_name, | |
| url: session_path(resource_name), | |
| html: { | |
| class: 'navbar-form navbar-right', | |
| role: 'login' | |
| }, &block) | |
| 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
| class ApplicationController < ActionController::Base | |
| # Prevent CSRF attacks by raising an exception. | |
| # For APIs, you may want to use :null_session instead. | |
| protect_from_forgery with: :exception | |
| private | |
| def current_cart | |
| @current_cart ||= begin | |
| Cart.find(session[:cart_id]) |
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 Ability | |
| include CanCan::Ability | |
| def initialize(user, *args) | |
| super(*args) | |
| alias_action :new, to: :write | |
| alias_action :create, to: :publish | |
| user ||= User.new # guest user (not logged in) | |
| if user.has_role? :admin | |
| can :manage, :all |
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 RegistrationsController < ApplicationController | |
| before_filter :authenticate_athlete!, :only => [:new, :create] | |
| def new | |
| @race = Race.find(params[:race_id]) | |
| @registration = @race.registrations.new | |
| end | |
| def create | |
| @race = Race.find(params[:race_id]) |
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
| ( | |
| %span{:id => "cart-counter" } | |
| = @cart && [email protected]? ? @cart.size : "0" | |
| ) | |
| or | |
| (<span id="cart-counter">#{@cart && [email protected]? ? @cart.size : "0"}) |
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
| 205356 <pothibo> tbuehlmann: https://gist.github.com/pothibo/6167471 | |
| 205405 <tbuehlmann> thanks a lot | |
| 205453 <pothibo> tbuehlmann: a few assumption here: First you use STL for different User e.g User Admin SuperAdmin, etc. You can retrieve the current_user | |
| 205515 <pothibo> my_controller.rb allow for controller level restrictions & per-action | |
| 205525 <pothibo> they work in conjunction |
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
| - player_url = URI.encode('http://'+request.host_with_port + player.url) | |
| - player_title = "AmericanSoccerNow: #{player.title}" | |
| - player_description = player.dek | |
| .detail | |
| .left | |
| - if player.hero_image and player.hero_image.attached | |
| = image_tag player.hero_image.attached.url, :height => 240, :width => 200 | |
| %span.imageCaption | |
| = player.hero_image.credit.try(:html_safe) |
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
| #!/usr/bin/env bash | |
| time=1500 # 25 minutes | |
| title="Pomodoro" | |
| icon=/home/yorickpeterse/Pictures/icons/tomato.png | |
| notify-send -i "$icon" "$title" "Starting a new Pomodoro timer" | |
| sleep $time |