Skip to content

Instantly share code, notes, and snippets.

coll.insert ({"type"=>"breeding", "doe"=>"C3", "buck"=>"C4", "date"=>to_utc(2014,11,7),
"exposures" => [
{"type"=>"exposure", "date" => to_utc(2014,11,7), "notes"=>"not interested"},
{"type"=>"exposure", "date" => to_utc(2014,11,8), "notes"=>"success"}
] }
)
coll.insert({"type"=>"breeding", "doe"=>"NZW8", "buck"=>"C4", "date"=>to_utc(2014,11,7),
"exposures" => [
{"type"=>"exposure", "date" => to_utc(2014,11,7), "notes"=>"success"},
{"type"=>"exposure", "date" =>to_utc(2014,11,8), "notes"=>"very upset!"}
I started with
{ :weight => 2.24, :count => 2, :date => to_utc(2014,11,10), :notes => "" }
then
{ :weight => 1.14, :date => to_utc(2014,11,10), :notes => "" }
{ :weight => 1.10, :date => to_utc(2014,11,10), :notes => "" }
But I only want one "thing" for each date, with the details stored inside. I tried:
{
"_id": {"$oid": "546396c27e12bd7eab000007"},
"id": "43",
"doe": "3BL",
"buck": "C16",
"birth_date": "2014-10-24 04:00:00 UTC",
"kindled": 2,
"survived": 2,
"weights": [
{
@wsmoak
wsmoak / gist:f8d407b19ec6e6c50a2e
Last active August 29, 2015 14:14
Chargify - Hide all shipping address fields (except country)
function hideShippingAddressFields()
{
$('#subscription_customer_attributes_address').hide();
$('#subscription_customer_attributes_address_2').hide();
$('#subscription_customer_attributes_city').hide();
$('#subscription_customer_attributes_state').hide();
@wsmoak
wsmoak / gist:b67109cdc4b46bfc9067
Created January 27, 2015 16:05
Chargify - Mark shipping country field as required
$(document).ready(function(){
var countryLabel = $('label[for="subscription_customer_attributes_country"]');
countryLabel.text("* " + countryLabel.text());
});
@wsmoak
wsmoak / chargify-layout.html
Created January 28, 2015 14:45
Chargify - Setting the background color for HTML email using a Layout
<html>
<body style="background: pink;">
<!-- start of email content -->
{{main_content}}
<!-- end of email content -->
</body>
</html>
@wsmoak
wsmoak / gist:c218a62c316d4b2329d4
Created February 20, 2015 23:21
Chargify - Change text for next renewal
function changeNextRenewalHtml() {
var nextRenewal = $('#next-renewal-charge');
nextRenewal.html("(then $35.00 on November 1st each year)");
};
$(document).bind("afterSummaryRefresh", changeNextRenewalHtml);
@wsmoak
wsmoak / gist:49ea3b44c40a113c180b
Created February 21, 2015 17:55
Chargify - Remove coupon success message
function removeCouponSuccessMessage() {
coupon_text = $('#long_coupon_message').find(".success_message");
coupon_text.text("");
};
$(document).bind("afterSummaryRefresh", removeCouponSuccessMessage);
@wsmoak
wsmoak / chargify-field-error-css
Last active August 29, 2015 14:16
Chargify Custom JavaScript and Custom CSS
.field-error {
color: #b94a48 !important;
background: #f2dede !important;
border: solid 1px #eed3d7 !important;
}
@wsmoak
wsmoak / component-default-and-required
Created May 4, 2015 17:47
Chargify - Default component quantity to 1 and require quantity to be > 0
$(function () {
var component1 = $("#component_allocated_quantity_XXXXX");
component1.val(1);
$("#subscription_submit").click(function(){
if ( component1.val() <= 0 ) {
component1.addClass("field-error");
return false;