This file contains 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
//arguments[0].class = 'twitterTickerWidget ' + arguments[0].class; | |
//should be changed to | |
arguments[0]["class"] = 'twitterTickerWidget ' + arguments[0]["class"]; | |
//because class is a reserved word. |
This file contains 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
module.exports = (function(){ | |
const MS = | |
{ seconds: 1000 | |
, minutes: 60 * 1000 | |
, hours: 60 * 60 * 1000 | |
, days: 24 * 60 * 60 * 1000 | |
, weeks: 7 * 24 * 60 * 60 * 1000 | |
, months: 30 * 7 * 24 * 60 * 60 * 1000 | |
, years: 365 * 24 * 60 * 60 * 1000 } |
This file contains 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 express = require('express'), | |
app = express.createServer(), | |
io = require('socket.io'); | |
app.configure(function(){ | |
app.use(express.methodOverride()); | |
app.use(express.bodyParser()); | |
app.use(app.router); | |
app.use(express.static(__dirname + '/../Public')); |
This file contains 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 socket = new io.Socket(); | |
//When a new mesasge arrives, create a dom node with the text inside, and place it | |
//in the top of the messages div. | |
//The color switches between red and blue depending on the sentCounter parameter in the message. | |
socket.on('message', function(data){ | |
var elm = document.createElement('p'); | |
var messagesDiv = document.getElementById('messages'); | |
elm.innerHTML = data.message; |
This file contains 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
#!/bin/bash | |
say -v 'Albert' Never gonna give you up | |
say -v 'Princess' Never gonna let you down | |
say -v 'Fred' Never gonna run around and desert you | |
say -v 'Pipe Organ' Never gonna make you cry | |
say -v 'Bahh' Never gonna say goodbye | |
say -v 'Hysterical' Never gonna tell a lie and hurt you | |
This file contains 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 getSquareOfSum = function(max) { | |
res = 0; | |
for(var i=1;i<=max;i++) { | |
res += i; | |
} | |
res = res*res; | |
return res; | |
} |
This file contains 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 getSumOfSquares = function(max) { | |
res = 0; | |
for(var i=1;i<=max;i++) { | |
res += i*i; | |
} | |
return res; | |
} |
This file contains 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 sys = require('sys'); | |
var Euler6 = function() { | |
var getSquareOfSum = function(max) { | |
res = 0; | |
for(var i=1;i<=max;i++) { | |
res += i; | |
} | |
res = res*res; |
This file contains 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 sys = require('sys'); | |
var Euler7 = function() { | |
var isPrimeNumber = function(num) { | |
//1 is NOT a prime number | |
if(num == 1) return false; | |
//2 is a prime number. | |
if(num == 2) return true; | |
//Exit early for even numbers (except 2 which is the only equal prime number). |
This file contains 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 sys = require('sys'); | |
var Euler8 = function() { | |
var digitString = '73167176531330624919225119674426574742355349194934' + | |
'96983520312774506326239578318016984801869478851843' + | |
'85861560789112949495459501737958331952853208805511' + | |
'12540698747158523863050715693290963295227443043557' + | |
'66896648950445244523161731856403098711121722383113' + | |
'62229893423380308135336276614282806444486645238749' + | |
'30358907296290491560440772390713810515859307960866' + |