Skip to content

Instantly share code, notes, and snippets.

module.exports = {
'link test': function (browser) {
var linkCount = 0;
var processed = 0;
var baseUrl = 'http://www.directvdeals.com';
function processLinks(iteration) {
{
"requireCurlyBraces": [
// "if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
@james-huston
james-huston / test.js
Created October 23, 2014 22:10
nsqd simple example
var nsq = require('nsq.js');
var reader = nsq.reader({
// nsqlookupd: ['localhost:4161'],
nsqd: ['localhost:4150'],
topic: 'events',
channel: 'ingestion',
maxInFlight: 250
});
@james-huston
james-huston / export.js
Created September 15, 2014 17:25
Easy to read amd/commonjs/window export
var MyModule = {};
// AMD support
if (typeof define === 'function' && define.amd) {
define(function () { return MyModule});
// CommonJS and Node.js module support.
} else if (typeof exports !== 'undefined') {
// Support Node.js specific `module.exports` (which can be a function)
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = MyModule;
@james-huston
james-huston / logger.go
Created September 2, 2014 13:25
Debugging errors
func (w *Worker) LogFailedMessage(msg *nsq.Message) {
log.Debug("❨╯°□°❩╯︵ %s", msg.Body)
}
@james-huston
james-huston / logrotate.conf
Last active August 29, 2015 14:05
logrotate for an app under messages
/var/log/appname/*.log {
compress
copytruncate
daily
rotate 3
size 10M
}
#!/bin/bash
# this needs to run inside of npm/npm-registry-couchapp
# https://github.com/npm/npm-registry-couchapp
HOST=http://localhost:5984
USER=npm
PASS=yourmomma
FULLHOST=http://$USER:$PASS@localhost:5984
@james-huston
james-huston / compile_couchdb
Last active July 3, 2016 18:35
Build and install couchdb on a new EC2 instance
#!/bin/bash
# very helpful page for getting this going
# http://www.everyhaironyourhead.com/installing-couchdb-1-5-on-amazon-linux/
#enable epel repo first yo!
sudo yum install gcc gcc-c++ libtool libicu-devel openssl-devel autoconf-archive erlang python27 python-sphinx help2man js-devel
# install spidermonkey from mozilla for faster version
# we skipp this since I couldn't get couch to work. need to revisit
@james-huston
james-huston / config_couchdb_npm
Last active August 29, 2015 14:05
Setup npm repo on RHL/CentOS
# enable epel repo
# install couchdb
sudo yum install couchdb
# create the ini file
echo "[httpd]
bind_address = 0.0.0.0
[couch_httpd_auth]
#!/bin/bash
PORT=443
iptables -I INPUT -p tcp --dport $PORT --syn -j DROP
sleep 1
service haproxy restart
iptables -D INPUT -p tcp --dport $PORT --syn -j DROP