Skip to content

Instantly share code, notes, and snippets.

@strikeout
strikeout / gist:5979392
Created July 11, 2013 21:24
WORKING server.js for openshift deployment of meteor app
////////// Requires //////////
var Fiber = require("fibers");
var fs = require("fs");
var http = require("http");
var path = require("path");
var url = require("url");
// connect (and some other NPM modules) use $NODE_ENV to make some decisions;
@strikeout
strikeout / header.js
Created November 13, 2013 11:28
Attach Meteor HTTP Headers
/**
* HTTP Header Security
*
* enforce HTTP Strict Transport Security (HSTS) to prevent ManInTheMiddle-attacks
* on supported browsers (all, but IE)
* > http://www.html5rocks.com/en/tutorials/security/transport-layer-security
*
* @header Strict-Transport-Security: max-age=2592000; includeSubDomains
*/
@strikeout
strikeout / cluster_observeChanges.js
Created January 9, 2014 16:50
please help me with my flawed logic on how to observeChanges in a clustered multi-server environment (with oplog-scaling).
// 200k entries and more
HugeCollection = new Meteor.Collection("HugeCollection");
// convenience collection to hold the computed stats of HugeCollection
StatsForHugeCollection = new Meteor.Collection("StatsForHugeCollection");
/**
* Observer
*/
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
@strikeout
strikeout / gist:cfa3c6d009e85a0c78d0
Created February 26, 2015 17:09
Apache vhost config for Meteor with working websockets
<VirtualHost 10.248.206.19:80>
ServerName some.domain.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
@strikeout
strikeout / sites-enabled__app.conf
Last active August 29, 2015 14:23
Nginx vhost config for Meteor with working websockets
server {
server_name thomassteinhauer.com;
location / {
root /var/www/app/bundle/;
}
location /admin {
root /var/www/admin/bundle/;
}
@strikeout
strikeout / addHostToMongoReplicaset.sh
Created October 8, 2015 10:20
Adds own host to a mongo replica-set. Runs on server-startup
#!/usr/bin/env bash
#get own hostname
ME=$(hostname);
# find replica-set master, we think its the first in the array
MASTER=`mongo --quiet --eval "cfg=rs.config(); print( cfg.members[0].host );"`
# connect to master, add ME
mongo --host $MASTER --eval "print( rs.add('"$ME"') );"
@strikeout
strikeout / dmp.php
Created May 27, 2016 14:14
dmp.php
<?
/**
* Debug helper function. This is a wrapper for var_dump() that adds
* the <pre /> tags, cleans up newlines and indents, and runs
* htmlentities() before output.
*
* @param mixed $var The variable to dump.
* @param string $label OPTIONAL Label to prepend to output.
* @param bool $echo OPTIONAL Echo output if true.
* @return string
@strikeout
strikeout / market.js
Created June 28, 2016 22:14 — forked from maxant/market.js
Files for creating a trading engine with Node.js.
// /////////////////////////////////////////////////
// this file contains all the classes related to a
// market.
// /////////////////////////////////////////////////
var log4js = require('log4js');
var logger = log4js.getLogger(require('path').basename(__filename, '.js'));
require('es6-collections');
var _ = require('underscore');
/**