Skip to content

Instantly share code, notes, and snippets.

View timhudson's full-sized avatar

Tim Hudson timhudson

View GitHub Profile
var query = {$or: [
{_id: req.params.id, app: req.app.id},
{altId: req.params.id, app: req.app.id}
]}
Show.findOne(query, function(err, show) {
// send them the show
})
/* Simple spam protection for email addresses using jQuery.
* Well, the protection isn’t jQuery-based, but you get the idea.
* This snippet allows you to slightly ‘obfuscate’ email addresses to make it harder for spambots to harvest them, while still offering a readable address to your visitors.
* E.g. Changed "at" to "atty" and "dot" to "dotty" to confuse some of the more intelligent harvesters.
* <a href="mailto:foo(atty)example(dotty)co(dotty)uk">foo aty example dotty co dotty uk</a>
* →
* <a href="mailto:foo@example.com">foo@example.co.uk</a>
*/
$(function() {
var one = 1
, two = 2
, three = 3
var one = 1,
two = 2,
three = 3;
var one = 1
var two = 2
var port = process.env.PORT || 3000
, host = process.env.HOST || 'localhost:3000'
app.set('port', process.env.PORT || 3000);
var host = process.env.HOST || 'localhost:'+app.get('port')
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/thrashr888/6047603/raw/6584ab9c5d500613303c852d79d619690b835305/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"

Usage

$ mongoexport -d test -c activities | node event-convert-stream.js | mongoimport -d test -c events
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/timhudson/6787518/raw/e11cd22f41e6cab71fe621b1f5a1377ff3af01ab/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db