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
var url = 'http://localhost:3000'; | |
var page = require('webpage').create(); | |
var pageCreator = require('webpage'); | |
var listeners = 0, | |
numListeners = 1, | |
loginCount = 0, | |
listenerPages = []; | |
(function () { |
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
var my_coll = new Meteor.Collection('my_coll'), | |
triggers = new Meteor.Collection('triggers'), | |
TRIGGER_TYPES = [ greaterThanFive: 'greaterThanFive' ]; | |
my_coll.after.update(function (userId, doc, fieldNames, modifier, options) { | |
if (doc.count > 5) { | |
_.each(triggers.find({ on: TRIGGER_TYPES.greaterThanFive }).fetch(), function (trig) { | |
switch (trig.event) { | |
case 'email': | |
Email.send(trig.to, { html: trig.markup }); |
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
var errors = new Meteor.Collection(null); | |
Template.my_templ.errors = function () { errors.find().fetch(); }; | |
Template.my_templ.events({ | |
'submit': function () { | |
if ($('#firstName').val() === '') { | |
errors.push({ msg: 'First Name Required' }); | |
} | |
} |
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
(function () { | |
var methods = ['children', 'closest', 'find', | |
'next', 'nextAll', 'nextUntil', | |
'offsetParent', 'parent', 'parents', | |
'parentsUntil', 'prev', 'prevAll', | |
'prevUntil', 'siblings' | |
]; | |
_.each(methods, function (method) { | |
JQuerySelector.prototype[method] = function (selector) { |
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
var EMAIL_INDEX = 2, | |
FIRSTNAME_INDEX = 0, | |
LASTNAME_INDEX = 1, | |
COMPANY_INDEX = 3; | |
$('#users').remove(); | |
$('body').prepend('<input type="file" id="users" />'); | |
$('#users').change(function () { | |
var csv = new FileReader(); |
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.randomImg1.img = function () { | |
return imgs.findOne({_id: Session.get('randomImg1') }); | |
}; | |
Template.randomImg2.img = function () { | |
return imgs.findOne({_id: Session.get('randomImg2') }); | |
}; | |
Template.randomImg3.img = function () { | |
return imgs.findOne({_id: Session.get('randomImg4') }); |
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
$(function () { | |
function html5_audio(){ | |
var a = document.createElement('audio'); | |
return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); | |
} | |
var play_html5_audio = false; | |
if(html5_audio()) play_html5_audio = true; | |
function play_sound(url){ |
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
var nodes = someFunc(); | |
var droppableNodes = [], i = 0; | |
for(i = 0; i < nodes.length; ++i) { | |
if(isDroppableNode(nodes[i]) | |
droppableNodes.push(nodes[i]); | |
} | |
$(nodes).droppable({ | |
drop: function () { |
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
if(Meteor.isClient) { | |
Meteor.startup(function () { | |
(function () { | |
var oldSubscription; | |
Meteor.setInterval(function () { | |
var subscription; | |
subscription = Meteor.subscribe('random-image', function () { | |
oldSubscription = subscription; | |
}); | |
if(oldSubscription) |
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
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
script | |
APP_DIR=/var/www/bundle | |
LOG_FILE=/var/log/meteorApp.log | |
export PORT=80 |