This file contains hidden or 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
common = | |
checkEnter: (e) -> return (e.keyCode is 13 and not e.shiftKey) | |
stopEvent: (e) -> | |
e.preventDefault() | |
e.stopPropagation() | |
autoScoll: (selector) -> | |
Meteor.clearTimeout(scroller) if scroller? | |
scroller = Meteor.setTimeout (-> | |
elm = @find(selector) | |
$(elm).scrollTop elm.scrollHeight), 100 |
This file contains hidden or 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
Template.bikeParts.rendered = -> | |
$('.priceTag').popover | |
placement: 'left' | |
title: 'Buy a part' | |
html: true | |
content: -> Meteor.render(Template.buyPartPopover) |
This file contains hidden or 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
common = | |
keepalive: -> | |
(update = -> Meteor.call('keepalive') if Meteor.userId())() | |
Meteor.clearInterval(Meteor.keepalive) if Meteor.keepalive? | |
Meteor.keepalive = Meteor.setInterval(update, config.keepalive * 1000) |
This file contains hidden or 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
superagent = require 'superagent' | |
async = require 'async' | |
_ = require 'underscore' | |
getCurrency = (currency, cb) -> | |
path = 'http://currency-api.appspot.com' + | |
'/api/USD/' + currency + '.json' + | |
'?key=880ab1d06e0c4453208104d7a52e321dfba70748' | |
agent = superagent.agent() | |
agent.get(path).end (err, res) -> | |
cb JSON.parse(res.text) |
This file contains hidden or 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
Meteor.publishCounter = (params) -> | |
count = 0 | |
init = true | |
id = Random.id() | |
pub = params.handle | |
collection = params.collection | |
handle = collection.find(params.filter, params.options).observeChanges | |
added: => | |
count++ | |
pub.changed(params.name, id, {count: count}) unless init |
This file contains hidden or 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
Meteor.publish 'bike', (id) -> | |
Meteor.publishWithRelations | |
handle: @ | |
collection: Bikes | |
filter: id | |
mappings: [ | |
key: 'userId' | |
options: { fields: config.users.publicFields } | |
collection: Meteor.users | |
, |
This file contains hidden or 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
Meteor.publish('bike', function(id) { | |
return Meteor.publishWithRelations({ | |
handle: this, | |
collection: Bikes, | |
filter: id, | |
mappings: [ | |
{ | |
key: 'userId', | |
options: { fields: config.users.publicFields }, | |
collection: Meteor.users |
This file contains hidden or 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
server { | |
root /var/www/bikecheck-alpha/static; | |
server_name alpha.bikecheck.ru; | |
location @static_cacheable { | |
root /var/www/bikecheck-alpha/static_cacheable; | |
} | |
location / { | |
try_files $uri @static_cacheable @node; | |
} |
This file contains hidden or 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
<template name='loadingWrapper'> | |
{{#if loading}} | |
<i class="icon-refresh icon-spin"></i> | |
Loading... | |
{{else}} | |
<div class="span9"> | |
{{renderPage}} | |
</div> | |
{{> sidebar }} | |
{{/if}} |
This file contains hidden or 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
Handlebars.registerHelper 'multiline', (string) -> | |
result = '' | |
for line in string.split("\n") | |
result += _.escape(line) + '<br/>' | |
return new Handlebars.SafeString(result) |
OlderNewer