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
// Get twitter status for given account (or for the default one, "PhantomJS") | |
var page = require('webpage').create(), | |
twitterUsername = '', | |
twitterPassword = ''; //< default value | |
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; |
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
(function(){ | |
var btn = document.createElement('div'); | |
//rotate an element | |
function rotate(el, angle) | |
{ | |
$(el).css({ | |
'-webkit-transform': 'rotate(' + angle + 'deg)', | |
'-moz-transform': 'rotate(' + angle + 'deg)', | |
'-ms-transform': 'rotate(' + angle + 'deg)', |
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
(function(){ | |
if (Models.chat._sendChat) { return; } | |
Models.chat._sendChat = Models.chat.sendChat; | |
Models.chat.sendChat = function(value){ | |
var sent = this._sendChat(value); | |
if (sent) | |
{ | |
$('#chat-input-field').css({color: '#CC4141'}); | |
setTimeout(function(){$('#chat-input-field').css({color: '#fff'});}, this.rateLimit * 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
//code | |
c.prototype.emit = function(a) { | |
var b = Array.prototype.slice.call(arguments, 1), c = b[b.length - 1], d = {type: "event",name: a}; | |
return "function" == typeof c && (d.id = ++this.ackPackets, d.ack = "data", this.acks[d.id] = c, b = b.slice(0, b.length - 1)), d.args = b, this.packet(d) | |
} | |
//approximate state on the return line | |
a: "chat" | |
arguments: Arguments[2] | |
0: "chat" |
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
//send just calls JSON.stringify and then client.write using that string | |
//respond to a ping | |
state.client.send({ | |
type: 'rpc', id: 2, | |
name: 'user.pong', args: []}); | |
//join a room | |
state.client.send({ | |
type: 'rpc', id: 1, |
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
//ok so this is pretty neat, you can just burst two messages every just over 3.33 seconds, | |
//and you never hit the rate limiter to cause the banning. Very groovy. | |
//constants | |
var delay = 3400, //ms to wait per burst | |
burst = 2; //burst the first 2 messages | |
//state | |
var messages = [], | |
timer = null; |