Skip to content

Instantly share code, notes, and snippets.

/*
* JavaScript Grammar
* ==================
*
* Based on grammar from ECMA-262, 5.1 Edition [1]. Generated parser builds a
* syntax tree compatible with Mozilla SpiderMonkey Parser API [2]. Properties
* and node types reflecting features not present in ECMA-262 are not included.
*
* Limitations:
*
c->s {"a":"qunsub","id":3} new-negotiation-cdfa786a2e26f65afbf0826fb829fc75.js:72004:3
c->s {"a":"qsub","id":3,"c":"users","q":{"_id":{"$in":["e2cc2159-4e8c-4daf-b5c0-a8bf15be8681","8bc235fc-6993-472d-953a-c2950a901c03","7d48d26e-b44b-4cfe-af9d-9e6b1fa0ecc9","4d26c823-3056-4cad-a8e0-c93e0362db2f","92c69bad-a1cd-40be-8645-608b0d613759","cdf48035-5213-4f10-87c2-4cb3f831783e","748d7964-f127-496a-bbd8-c6ed86593d4a","b159d250-87c5-4ab4-8c45-770cd55f778d","86100a7e-19bc-4d3e-9ba6-9bc5591ebcc2","ef372699-339d-4067-84d2-6d2c1ce4995d"]}},"vs":{"4d26c823-3056-4cad-a8e0-c93e0362db2f":9,"748d7964-f127-496a-bbd8-c6ed86593d4a":9,"7d48d26e-b44b-4cfe-af9d-9e6b1fa0ecc9":9,"86100a7e-19bc-4d3e-9ba6-9bc5591ebcc2":9,"8bc235fc-6993-472d-953a-c2950a901c03":9,"92c69bad-a1cd-40be-8645-608b0d613759":9,"b159d250-87c5-4ab4-8c45-770cd55f778d":9,"cdf48035-5213-4f10-87c2-4cb3f831783e":9,"df993738-3864-4494-ae63-2ff04da821b7":9,"e2cc2159-4e8c-4daf-b5c0-a8bf15be8681":9,"ef372699-339d-4067-84d2-6d2c1ce4995d":9}} new-negotiation-cdfa786a2e26f6
@minicuper
minicuper / sample-app
Last active August 27, 2015 08:10 — forked from fideloper/sample-app
Sample application Upstart script, using Forever
#!/bin/bash
# Sample App Init script for running sample app daemon
#
# chkconfig: - 98 02
#
# description: Sample Application Upstart, using Forever
APPHOME=/opt/sample-app
APPSCRIPT=app.js
@minicuper
minicuper / hook.coffee
Last active August 29, 2015 14:23 — forked from enjalot/hook.coffee
#make a hook
store.hook 'change', 'collection.*.foo', (docId, value, op, session, backend) ->
model = store.createModel()
#logic
#setup the hook method
store.hook = (method, pattern, fn) ->
store.shareClient.use 'after submit', (shareRequest, next) ->
{opData} = shareRequest
@minicuper
minicuper / run.sh
Last active August 29, 2015 14:19 — forked from irasally/run.sh
#!/bin/sh
mongo localhost:27017/mongo run_command.js
mongo localhost:27018/mongo run_command.js
mongo localhost:27019/mongo run_command.js
# if you don't need connection infomation etc., use --quiet option.
# http://www.mongodb.org/display/DOCS/--quiet
<html>
<head>
<title>Gamepad</title>
</head>
<body>
<script type="text/javascript">
(function () {
var j;
function tablefy(arr) {
// example function where arguments 2 and 3 are optional
function example( err, optionalA, optionalB, callback ) {
// retrieve arguments as array
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
// first argument is the error object
@minicuper
minicuper / no-x.js
Last active August 29, 2015 14:06 — forked from mhulse/no-x.js
/* ==========================================================================
no-touch & no-js
========================================================================== */
/*! https://gist.github.com/mhulse/4704893 */
;(function(window, document, navigator) {
(('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) && (document.documentElement.className = document.documentElement.className.replace(/\bno-touch\b/, 'touch'));
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/, 'js');
# Whitelist collections
ALLOW_COLLECTIONS = {
'accounts': true
'users': true
}
module.exports = (shareClient) ->
# Hold on to session object for later use. The HTTP req object is only
# available in the connect event
shareClient.use 'connect', (shareRequest, next) ->
MONTH_NAMES = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
]
moment = (input, format, lang, strict) ->
moment = require 'moment-timezone'
return moment input, format, lang, strict
formats =