Skip to content

Instantly share code, notes, and snippets.

$('#quick_entry form').live 'submit', (event) ->
event.preventDefault() # just moved up!
event.stopPropagation() # just moved up!
return false if @beenSubmitted
@beenSubmitted = true
clearNotice()
$.ajax({
type: 'POST'
url: @action
dataType: 'json'
@blt04
blt04 / mongoid_serialization.rb
Created December 16, 2010 18:52
Mongoid::Document XML and JSON serialization customizations
#
# This core extension customizes XML and JSON serialization in Mongoid::Document
# objects:
# * Serializes BSON::ObjectIDs as strings in XML
# * Removes leading underscores from attributes (such as _id, _type)
# * Allows documents to customize serialization even further by declaring a
# `serialize_attributes!` method, e.g.:
# def serialize_attributes!(attribute_hash)
# attribute_hash.delete(:unnecessary_key)
# attribute_hash[:password] = ''
@thbar
thbar / chef-solo Rakefile.rb
Created November 23, 2010 18:48
Authored by someone else (don't have the name) and tweaked by me
REMOTE_CHEF_PATH = "/etc/chef"
SSH_PORT = XXX
desc "Test your cookbooks and config files for syntax errors"
task :test do
Dir[ File.join(File.dirname(__FILE__), "**", "*.rb") ].each do |recipe|
sh %{ruby -c #{recipe}} do |ok, res|
raise "Syntax error in #{recipe}" if not ok
end
end
@apsoto
apsoto / knife-config.staging.rb
Created November 22, 2010 19:21
Managing different chef environments using git branches
log_level :debug
log_location STDOUT
validation_client_name 'channels-staging-validator'
validation_key './.chef/channels-staging-validator.pem'
chef_server_url 'https://api.opscode.com/organizations/channels-staging'
cache_options( :path => './.chef/channels-staging-checksums' )
package preloadagent;
/**
Copyright 2010 Sam Pullara
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