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 allows you to represents a JavaScript function with a proc. When converted to JSON, it will | |
# automatically wrap the method body with "function(){" and "}" and list as many arguments as you | |
# had listed in your proc, automatically giving them the names a, b, c, etc. | |
# | |
# This is convenient when you want to create a Ruby hash representating options to be passed to | |
# a JavaScript method, which you plan to call to_json on when you actually output the method call | |
# to the web page. If you tried to represent your JavaScript function with a string value in the | |
# hash, then when you called to_json on the hash, it would in turn call String#to_json, which | |
# returns an escaped copy of the string surrounded by quotes. | |
# |
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
# ACK: | |
# modified from | |
# http://gist.github.com/264496 by github.com/eric | |
# http://gist.github.com/465293 by github.com/alexyoung | |
# USAGE: | |
# 1) > ruby -rrequire_tracking -e "require 'active_support'" | |
# 2) put in config/preinitializer.rb | |
# WHAT: Provides a simple overview of memory allocation occuring |
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
# Author:: Adam Jacob <adam@opscode.com> | |
# Author:: Joshua Timberman <joshua@opscode.com> | |
# | |
# Copyright 2009-2010, Opscode, Inc | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.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
# Allows Tasks that have no servers to be skipped instead of raising a NoMatchingServersError | |
module Capistrano | |
class Configuration | |
module Connections | |
def execute_on_servers(options={}) | |
raise ArgumentError, "expected a block" unless block_given? | |
if task = current_task | |
servers = find_servers_for_task(task, options) |
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
################################## | |
# MIT LICENSE | |
# Copyright (C) 2012 Luke Bayes | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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 AfterCommit | |
def self.included(base) | |
base.class_eval do | |
[:save, :save!].each do |method| | |
alias_method_chain method, :after_commit | |
end | |
end | |
base.define_callbacks :after_commit, :after_commit_on_create | |
end | |
NewerOlder