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
describe "GET current" do | |
before do | |
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}" | |
get :current, :format => 'js' | |
end | |
it { should respond_with(:success) } | |
it { should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") } | |
it { should render_template('notices/current') } | |
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
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') | |
class BuildStatusTest < ActiveSupport::TestCase | |
test "remove the old statii" do | |
assert_equal 2, BuildStatus.count | |
BuildStatus.expire_old | |
statii = BuildStatus.all | |
assert_equal 1, statii.size | |
assert statii[0].updated_at >= 30.days.ago | |
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
kendall :: git/rbx » ruby scratch/bm_either.rb | |
Rehearsal --------------------------------------------- | |
includes? 4.410000 0.000000 4.410000 ( 4.421223) | |
either? 6.450000 0.000000 6.450000 ( 6.478906) | |
compare 2.040000 0.010000 2.050000 ( 2.044516) | |
----------------------------------- total: 12.910000sec | |
user system total real | |
includes? 4.470000 0.000000 4.470000 ( 4.479386) | |
either? 6.520000 0.000000 6.520000 ( 6.542424) |
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
module Pjax | |
extend ActiveSupport::Concern | |
included do | |
layout ->(c) { pjax_request? ? false : 'application' } | |
end | |
private | |
def redirect_pjax_to(action, url = nil) | |
new_url = url_for(url ? url : { action: action }) |
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 NotesController < ApplicationController | |
def create | |
@note = @project.notes.create params[:note].merge( | |
creator: current_user, subscribers: extract_subscribers(params[:note])) | |
@note.subscribers.each { |subscriber| Subscriptions.note(@note, subscriber).deliver } | |
end | |
end | |
class Subscriptions < ActionMailer::Base |
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
Designers need fleshed out pages to do properly design a screen. | |
In the past, we've loaded test fixtures in development to give them that. | |
But test fixtures are not a good fit for this. | |
They're designed to make testing easy, not designing. | |
What we need instead is a way for a designer to create a dataset | |
that'll work great for design and then save that as a snapshot. | |
This snapshot can be named and reloaded as often as desired. | |
I envision it'll work like this: |
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
# Bulk API design | |
# | |
# resources :posts | |
class PostsController < ActiveController::Base | |
# GET /posts/1,4,50,90 | |
# post_url([ @post, @post ]) | |
def show_many | |
@posts = Post.find(params[:ids]) | |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
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
def revoke(user) | |
proxy_association.owner.tap do |project| | |
# You can't remove the last user with access (someone has to have access to the project!) | |
if project.users.many? | |
if user.pending? && user.projects.one? | |
user.destroy | |
else | |
project.users.delete(user) | |
user.touch | |
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
Hi David, | |
I came across your profile online and wanted to reach out about Development | |
Opportunities here at Groupon. The company is growing, and we're always | |
looking for folks with solid skills that can make positive contribution to | |
our continued success. Any chance you'd be open to a quick conversation | |
about opportunities, or for any possible networking potential? If so, let me | |
know when you're free and we can set up a time to chat. Also, if you are | |
interested, it would be great if you could forward a current resume over | |
that I can take a look at. I look forward to hearing back from you! Please | |
let me know if you have any questions. |