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
Browse: | |
https://oauth.twitter.com/2/authorize?oauth_callback_url=http://www.skyrock.com/&oauth_mode=flow_web_client&oauth_client_identifier=7ynojZQ3uVE2DifWftbS3w | |
After authentication, user gets redirected to: | |
http://www.skyrock.com/#oauth_access_token=RnEJAQAAAABpYH8NAAAAAGKSBQAAAAAAr9G2hLrnXaznri8LlSIaR0HuNBI=HLx1r47oqpobPncAm9DNeRCdySaMqoTKJcCLwnhIP&oauth_bridge_code=2wxWDd3IIZ0UW1y4oFpioWfbzTeaAlSGoJk5L6qMpGQ | |
...Use the API: |
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 sys = require('sys'), | |
Emission = require('./emission'); | |
var emission = new Emission(); | |
emission.cycle(); | |
emission.on('recycle', function(cycles) { | |
if (cycles < 10) { | |
sys.puts(cycles); | |
} |
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 sys = require('sys'), | |
events = require('events'); | |
var Emission = module.exports = function () { | |
events.EventEmitter.call(this); | |
this.cycles = 0; | |
}; | |
sys.inherits(Emission, events.EventEmitter); |
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
Array.prototype.intersect = function(b) { | |
return this.filter(function(n) { | |
return (b.indexOf(n) != -1); | |
}); | |
} | |
Array.prototype.diff = function(a) { | |
return this.filter(function(n) { | |
return !(a.indexOf(n) > -1); | |
}); |
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
String.prototype.replaceAt = function(index, char) { | |
return this.substr(0, index) + char + this.substr(index + char.length); | |
} |
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 Timespan = function(milliseconds) { | |
this.milliseconds = milliseconds; | |
this.seconds = this.milliseconds / 1000; | |
this.minutes = this.seconds / 60; | |
this.hours = this.minutes / 60; | |
this.days = this.hours / 24; | |
this.weeks = this.days / 7; | |
this.months = this.days / 30; | |
this.years = this.months / 12; | |
this.centuries = this.years / 100; |
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 zero_pad = function(value, length) { | |
value = value.toString(); | |
while (value.length < length) | |
value = '0' + value; | |
return value; | |
}; |
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
String.prototype.repeat = function(times) { | |
return new Array(isNaN(times) ? 1 : ++times).join(this); | |
} |
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 json_escape = function(value) { | |
if (value.replace) | |
return value.replace(/\//g, '\\/') | |
else | |
return value | |
} | |
var json_to_html = function(json, level) { | |
level = level || 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
var head = document.getElementsByTagName('head')[0]; | |
var meta = document.createElement('meta'); | |
meta.setAttribute('http-equiv', 'X-UA-Compatible'); | |
meta.setAttribute('content', 'IE=EmulateIE7'); | |
head.appendChild(meta); |