A simple example to create a websocket server and stream tweets about a pre-defined subject to the page.
$ npm install socket.io, twitter
$ node ./app.js
| # Make sure to notice the comments at https://gist.github.com/jhass/719014#gistcomment-19774 | |
| <VirtualHost *:80> | |
| ServerName diaspora.example.org | |
| ServerAlias www.diaspora.example.org | |
| RedirectPermanent / https://diaspora.example.org/ | |
| </VirtualHost> | |
| <VirtualHost *:443> | |
| ServerName diaspora.example.org |
| /* | |
| Zooming and rotating HTML5 video player | |
| Homepage: http://github.com/codepo8/rotatezoomHTML5video | |
| Copyright (c) 2011 Christian Heilmann | |
| Code licensed under the BSD License: | |
| http://wait-till-i.com/license.txt | |
| */ | |
| (function(){ | |
| /* predefine zoom and rotate */ |
| /* | |
| * base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers | |
| * | |
| * (C) 2010, Nodejitsu Inc. | |
| * | |
| */ | |
| var base64 = exports; | |
| base64.encode = function (unencoded) { |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "log" | |
| "net/http" | |
| "os" | |
| ) |
| var mongoose = require('./index') | |
| , TempSchema = new mongoose.Schema({ | |
| salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']} | |
| }); | |
| var Temp = mongoose.model('Temp', TempSchema); | |
| console.log(Temp.schema.path('salutation').enumValues); | |
| var temp = new Temp(); | |
| console.log(temp.schema.path('salutation').enumValues); |
| var http = require('http'), | |
| fileSystem = require('fs'), | |
| path = require('path') | |
| util = require('util'); | |
| http.createServer(function(request, response) { | |
| var filePath = 'path_to_file.mp3'; | |
| var stat = fileSystem.statSync(filePath); | |
| response.writeHead(200, { |
| # This is not a complete Nginx configuration! It only shows the relevant parts for integrating Diaspora. | |
| # [...] | |
| http { | |
| # Your standard server configuration goes here | |
| # [...] | |
| gzip_static on; |
| # webm | |
| ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm | |
| # mp4 | |
| ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4 | |
| # ogg (if you want to support older Firefox) | |
| ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend |