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
- (void)loginViewControllerDidClose:(DSLoginViewController *)loginViewController | |
{ | |
// HACK | |
// | |
// Work around a bug(?) where the login VC's view disappears immediately | |
// (without animation) before our own view then animates away. We want | |
// only the login VC's view to animate, with all underlying views | |
// disappearing (invisibly) underneath at the same time. AFAICT, this is | |
// what _should_ happen: | |
// |
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
/* | |
Just the Notifications, please | |
============================== | |
1. Make a Fluid (http://fluidapp.com/) instance of https://twitter.com/i/notifications | |
2. Apply the below CSS as a Userstyles stylesheet | |
3. Enjoy just the conversation, not the timeline | |
Why? |
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
Dir["#{Rails.root}/app/*/**"].each do |dir| | |
case File.basename(dir) | |
when 'assets' | |
Dir["#{dir}/*"].each do |assets_dir| | |
Rails.application.config.assets.paths << assets_dir | |
Dir["#{assets_dir}/*"].each do |asset| | |
parts = File.basename(asset).split('.') | |
name = "#{parts.first}.#{parts.second}" | |
Rails.application.config.assets.precompile += [name] | |
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
# RSpec's subject method, both implicitly and explicitly set, is useful for | |
# declaratively setting up the context of the object under test. If you provide a | |
# class for your describe block, subject will implicitly be set to a new instance | |
# of this class (with no arguments passed to the constructor). If you want | |
# something more complex done, such as setting arguments, you can use the | |
# explicit subject setter, which takes a block. | |
describe Person do | |
context "born 19 years ago" do | |
subject { Person.new(:birthdate => 19.years.ago } | |
it { should be_eligible_to_vote } |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Preventing kernel panics - VirtualBox 4.1 and Mac OS X Lion 10.7. | |
# | |
# This happens on my Macbook Air Mid-2011 Core i7. Every few hours, with | |
# one or (particularly) more VMs running, you will get a kernel panic. | |
# | |
# Some reading: | |
# https://www.virtualbox.org/ticket/9359 |
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
source :rubygems | |
gem 'faraday', '>= 0.8.0.rc2' | |
gem 'faraday_middleware' |
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 Rack | |
class DeflaterWithExclusions < Deflater | |
def initialize(app, options = {}) | |
@app = app | |
@exclude = options[:exclude] | |
end | |
def call(env) | |
if @exclude && @exclude.call(env) |
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
#pagelet_netego_lower, | |
#home_sponsor_nile, | |
.showIfOffline, | |
.ego_section, | |
.fbEmuEgoUnit, | |
.fbEmuEgoUnitFirst, | |
#pagelet_presence, | |
#chatFriendsOnline | |
{ | |
display: none !important; |
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
<ul> | |
<% User.all.with_item_counts do |user| %> | |
<li><%= user.username %> - Items: <%= user.calculated_item_count %> | |
<% end %> | |
</ul> |
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
# This is how I would like the models | |
# | |
# Order has an extension on its order_transactions association to return the total amount of all the transactions | |
# | |
# I want to call this extension method while modifying the association via a named scope, but it doesn't work (see below). | |
class OrderTransaction < ActiveRecord::Base | |
scope :purchases, where(:action => 'purchase') | |
scope :refunds, where(:action => 'credit') | |
end |