Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
angular.module('appMap', ['ui.map']) | |
.controller('MapCtrl', ['$scope', function ($scope) { | |
$scope.mapOptions = { | |
center: new google.maps.LatLng(37.7833, -122.4167), | |
zoom: 13, | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
disableDefaultUI: true, | |
zoomControl: true, | |
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU | |
}; |
var controller = function($scope) { | |
$scope.e = { | |
location:"Albany, NY", | |
locationAbout:"Try an address, a city, a place, or even latitude and longitude.", | |
API:"", | |
APIAbout:"You don't always need an API Key for Static Maps, but it's easy to acquire one. Without a key you might receive an error image instead of a map. Follow the link to the API Console.", | |
zoom:13, | |
minZoom:0, | |
maxZoom:22, | |
scaleAbout:"Scale will double the stated height and width. This is good for when you need a width or height larger than 640px.", |
'use strict'; | |
/** | |
* AccountController allows the User to change settings, link with their GitHub accounts, etc | |
*/ | |
skeletonApp.controller('AccountController', [ | |
'$scope', '$location', '$rootScope', 'OAuthService', 'ParseService', function($scope, $location, $rootScope, OAuthService, ParseService) { | |
// redirect to "/login" if user is not logged in |
$ = jQuery | |
TIMEOUT = 20000 | |
lastTime = (new Date()).getTime() | |
setInterval -> | |
currentTime = (new Date()).getTime() | |
# If timeout was paused (ignoring small | |
# variations) then trigger the 'wake' event | |
if currentTime > (lastTime + TIMEOUT + 2000) |
$ = jQuery | |
queues = {} | |
running = false | |
queue = (name) -> | |
name = 'default' if name is true | |
queues[name] or= [] | |
next = (name) -> |
$ = jQuery | |
TRANSFORM_TYPES = ['PUT', 'POST', 'DELETE'] | |
$.activeTransforms = 0 | |
$(document).ajaxSend (e, xhr, settings) -> | |
return unless settings.type in TRANSFORM_TYPES | |
$.activeTransforms += 1 |
function ContactCtrl($scope, $http) { | |
$scope.success = false; | |
$scope.httpError = false; | |
$scope.send = function() { | |
var job = { job: { klass: 'msg', args: [$scope.msg]}}; | |
$http.post('/contact',job). | |
success(function(data){ | |
$scope.success = true; | |
$scope.msg = {}; |
description "Upstart script to run a nodejs app as a service" | |
author "Louis Chatriot" | |
env NODE_BIN=/usr/local/bin/node | |
env APP_DIR=/path/to/app/dir | |
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app | |
env LOG_FILE=/path/to/logfile.log | |
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges | |
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...) | |
# I typically use the environment variable NODE_ENV (see below) |