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 Serializer < Struct.new(:object) | |
def to_hash | |
@hash ||= hash_object(object) | |
end | |
private | |
def hash_object(object) | |
hash = {} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You 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
def diff_hash(from, to) | |
differences = {} | |
to.each do |key, value| | |
if value.is_a? Hash | |
differences[key] = diff_hash_changed_items(from[key], value) | |
elsif value.is_a?(Array) | |
differences[key] = diff_array(value, from[key]) |
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
var Forms = { | |
generatedId: function() { | |
return String(new Date().getTime()); | |
}, | |
applyAddFieldsBehaviour: function() { | |
var self = this; | |
$('.add_fields[data-content]').each(self._applyAddFieldBehaviour); | |
}, |
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
%fieldset | |
%h3= PressRelease.model_name.human :count => 2 | |
= nested_fields_for form, :press_releases do |nested_form| | |
%fieldset | |
= nested_form.input :description | |
= nested_form.input :url | |
= nav_for_existing_record nested_form |
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 FormsHelper | |
def nested_fields_for(form, association, &block) | |
field_html = form.simple_fields_for(association, &block) | |
new_html = form.simple_fields_for(association, new_association_object(form, association), :child_index => 'new', &block) | |
(field_html + nav_for_new_record(new_html)).html_safe | |
end | |
def nav_for_new_record(html_for_add) |
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
// IE7 hacks | |
// cellspacing hack | |
if(jQuery.browser.msie && parseInt(jQuery.browser.version) == 7) { | |
$(function() { | |
$('table').each( function() { | |
var table = $(this); | |
if(spacing = table.css('border-spacing')) { | |
table.attr('cellspacing', parseInt(spacing)); |
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
# .metrics | |
cucumber_path = `which cucumber`.strip | |
MetricFu::Configuration.run do |config| | |
config.rcov[:rcov_opts] << '--aggregate tmp/metric_fu/scratch/rcov/coverage.data' | |
config.rcov[:rcov_opts] << '&&' | |
config.rcov[:rcov_opts] << "rcov #{cucumber_path}" | |
config.rcov[:rcov_opts] << '--no-html' | |
config.rcov[:rcov_opts] << '--text-coverage' | |
config.rcov[:rcov_opts] << '--no-color' |
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 'hirb' | |
# parse MERB log file | |
file = ARGV.first | |
exit unless File.exists?(file) | |
actions = {} | |
controller = nil | |
action = nil |
NewerOlder