Skip to content

Instantly share code, notes, and snippets.

$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.default_options, options
$(this).each (i, el) ->
self.init el, opts
self.log el if opts.log
$.extend $.fn.myplugin,
default_options:
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
@ZenCocoon
ZenCocoon / JSON API Compound Documents.json
Last active August 29, 2015 13:59
JSON API Compound Documents
{
"links": {
"posts.author": {
"href": "http://example.com/people/{posts.author}",
"type": "people"
},
"posts.comments": {
"href": "http://example.com/comments/{posts.comments}",
"type": "comments"
}
en:
locale_names:
af: "Afrikaans"
sq: "Albanian"
ar: "Arabic"
hy: "Armenian"
az: "Azerbaijani"
eu: "Basque"
be: "Belarusian"
bn: "Bengali"
@ZenCocoon
ZenCocoon / custom_inquiry_form
Last active August 29, 2015 14:20
BookingSync Custom/Self-Hosted Inquiry Form
<form accept-charset="UTF-8" action="https://www.bookingsync.com/en/mybookings/1/inquire" method="post">
<div style="display:none"><input name="utf8" type="hidden" value="✓"></div>
<label for="inquiry_rental_id">Rental</label>
<select id="inquiry_rental_id" name="inquiry[rental_id]">
<option selected="selected" value="1234">Villa Boubouki</option>
<option value="1235">Villa Anatoli</option>
<option value="1236">Villa Amoudia</option>
<option value="1237">Villa Sivota</option>
</select>
{
"links": {
"rentals.account": "https://www.bookingsync.com/api/v3/accounts/{rentals.account}",
"rentals.availability": "https://www.bookingsync.com/api/v3/availabilities/{rentals.availability}",
"rentals.destination": "https://www.bookingsync.com/api/v3/destinations/{rentals.destination}",
"rentals.rates_table": "https://www.bookingsync.com/api/v3/rates_tables/{rentals.rates_table}",
"rentals.rental_agreement": "https://www.bookingsync.com/api/v3/rental_agreements/{rentals.rental_agreement}",
"rentals.photos": "https://www.bookingsync.com/api/v3/photos/{rentals.photos}",
"rentals.reviews": "https://www.bookingsync.com/api/v3/reviews/{rentals.reviews}",
"rentals.special_offers": "https://www.bookingsync.com/api/v3/special_offers/{rentals.special_offers}",
@ZenCocoon
ZenCocoon / booknow.liquid
Last active August 29, 2015 14:24
Live price check using BookingSync Javascript API v2
<form id="bs_booknow_form" action="{{ rental.booknow_url }}" method="get">
<input type="hidden" id="bs_booknow_rental_id" name="rental_id" value="{{ rental.bookingsync_id }}" />
<input type="hidden" id="bs_booknow_source" name="source" value="{{ site.domain }}" />
<input type="hidden" id="bs_booknow_include_tentative" name="include_tentative" value="{{ site.tentatives_as_available }}">
<div class="row">
<div class="col-xs-6 col-sm-12 col-md-6">
<div class="form-group date">
<label class="date control-label" for="bs_booknow_start_at">
{% t 'search.form.checkin' %}</label>
<input autocomplete="off" class="date form-control" data-datepicker=""
@ZenCocoon
ZenCocoon / bootstrap.datepicker.js
Created July 8, 2015 13:52
BookingSync version for the Bootstrap Datepicker. Adding support for availability map and more
/* ===========================================================
* bootstrap-datepicker.js v1.3.0
* http://twitter.github.com/bootstrap/javascript.html#datepicker
* ===========================================================
* Copyright 2011 Twitter, 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
*
@ZenCocoon
ZenCocoon / huboard-condensed-issues.css
Created January 13, 2016 05:56
Condensed HuBoard style
// Currently used with the bookmarklet http://www.paulirish.com/2008/bookmarklet-inject-new-css-rules/
.card { padding: 0 0 0 4px; margin-bottom: 0; border-bottom: 0 }
.card .title {
font-size: 12px;
line-height: 14px;
}
.card .hb-avatar-tooltip, .card .number { display: none; }
@ZenCocoon
ZenCocoon / _menu.liquid
Last active June 1, 2016 11:19
Handle sub-submenus with BookingSync generated websites
Replace:
``` liquid
<li><a href="{{ subitem.url }}">{{ subitem.title }}</a></li>
```
By:
``` liquid