This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, fs = require('fs') | |
, PORT = process.argv[2] || 8080 | |
, HOST = process.argv[3] || '127.0.0.1'; | |
http.createServer(function (req, res) { | |
if (req.url == '/events') { | |
res.writeHead(200, { 'Content-Type' : 'text/event-stream' | |
, 'Cache-Control' : 'no-cache' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove the current playlist | |
var files = turntable.playlist.files; | |
var arr = []; | |
for (var i=0, len=files.length; i<len; i++) { | |
arr.push(files[i].fileId); | |
} | |
function remRec(arr) { | |
var fileId = arr.splice(0, 1)[0]; | |
turntable.playlist.removeFile(fileId); | |
if (arr.length > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Intallation: | |
// npm install jsdom jquery | |
var jsdom = require('jsdom'); | |
jsdom.env('http://google.ca/', null, function (err, window) { | |
$ = require('jquery').create(window); | |
$('a').each(function () { | |
console.log($(this).attr('href'), ' ---> ', $(this).text()); | |
}); |
NewerOlder