This file contains 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 AnnouncementsController < ApplicationController | |
# Creates an array (if needed) and stores that array in the session so we know which | |
# announcements the current_user has seen | |
# | |
# @todo: Add test | |
# | |
def hide | |
( session[:announcement_ids] ||= [] ) << params[:id] | |
This file contains 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
# Customize Prompt | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="\[\033[01;30m\]\u@\h\[\033[m\] : \[\033[01;34m\]\w\[\033[m\] \[\033[31m\]\$(parse_git_branch) \[\033[00m\]\$ " |
This file contains 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
# VERSION 1: | |
can [ :create, :read, :download ], Attachment do |attachment| | |
user.can? :read, attachment.attachable | |
end | |
can [ :update, :destroy ], Attachment do |attachment| | |
user.administrator? or attachment.try( :user_id ) == user.id | |
end | |
# VERSION 2: | |
can do |action, subject_class, subject| |
This file contains 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
#Assign `True` or `False` as appropriate on the lines below! | |
# 17 < 118 % 100 | |
# They're asking for this: | |
bool_one = True | |
# I gave them this: | |
bool_one = 17 < 118 % 100 |
This file contains 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 Import | |
# Mixins | |
include ImportExceptions | |
# 0: is the Film Festival we want to relate to a Tab | |
# 1: the Regionalmovie ID | |
attr_accessor :attributes | |
attr_accessor :regionalmovie | |
attr_accessor :tab |
This file contains 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/local/bin/zsh | |
echo "You probably want to run this from your master branch..." | |
# Remove any existing LATEST_CHANGES.md files: | |
rm LATEST_CHANGES.md | |
# Get the latest tag from the git index | |
LATEST_TAG=`git describe --abbrev=0` |
This file contains 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 'rubygems' | |
require 'active_shipping' | |
include ActiveMerchant::Shipping | |
####### START: STORE THIS IN A CONFIG FILE | |
MyApp::Application.config.fedex_credentials = { | |
account: '1234567890', | |
password: '1234567890abcdefgh1234567890', | |
key: '1234567890abcde', | |
login: '12345678' |
This file contains 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
https://www.google.com/calendar/render?action=TEMPLATE&dates=20130911T010000Z/20130911T040000Z&sprop=website:http://www.meetup.com/vancouver-ruby/events/132066952/&text=%23VANRUBY+Hack+Night&location=Launch+Academy+-+%23300+-+128+West+Hastings+Street+-+Vancouver,+BC+,+Canada&sprop=name:Vancouver+Ruby+Meetup+Group&details=For+full+details,+including+the+address,+and+to+RSVP+see:%0Ahttp://www.meetup.com/vancouver-ruby/events/132066952/%0AVancouver+Ruby+Meetup+Group%0A%23VANRUBY+hack+nights%0AEvery%C2%A02%C2%A0weeks%C2%A0on%C2%A0Tuesday+we%C2%A0get%C2%A0together%C2%A0to%C2%A0hack%C2%A0on%C2%A0cool%C2%A0stuff.%0ABring+a+your+laptop+and+hack+away%26hellip;&gsessionid=NDe9TU_NAxwoB7UaIJ2Lhw&sf=true&output=xml |
This file contains 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
4..30.each do |x| | |
puts x * 2 | |
end |
This file contains 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
1. Was receiving this strange error: | |
undefined method 'action_view' for #<Rails::Railtie::Configuration... | |
Had to add this to the top of `config/application.rb`: | |
require "action_view/railtie" | |
2. ActionMailer URL host config not being setup correctly: | |
config.action_mailer.default_url_options = {host: "s.caliper.io"} | |
Rails.application.config.action_mailer.default_url_options |