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 Array() { | |
var foo = this; | |
var bar = function() { | |
var ret = "Captured array items are: "; | |
//notify an attacker. Here we just display it | |
alert(ret); | |
}; | |
setTimeout(bar, 100); | |
} |
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
<script src="https://mail.google.com/mail/c/u/0/data/contactstore"></script> |
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 assertType(obj, type) { | |
return obj.constructor.name === type.name | |
} | |
Object.prototype.assertType = function(type) { | |
return this.constructor.name === type.name | |
} | |
//Preparing test, mock objects | |
function Book(){}; |
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
$('.box').find('p'); | |
//or | |
$('.box').children('p'); |
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
$('.box p'); |
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
motionjs.transition([{ | |
select: "#hello_world", | |
duration: '4s', | |
style: { | |
top: '200px', | |
opacity: 1 | |
}, | |
end: function (event) { | |
alert("End of transition."); | |
} |
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
socket.on('connect', function () { | |
socket.on('message', function (data) { | |
var newElement = document.createElement('li'); | |
newElement.innerHTML = data.message[0] + ' says: ' + data.message[1]; | |
document.getElementById("list").appendChild(newElement); | |
}); | |
socket.on('announcement', function (data) { | |
var newElement = document.createElement('li'); | |
newElement.className = 'announcement'; |
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 buffer = []; | |
io.sockets.on('connection', function(client) { | |
client.emit('history', { buffer: buffer }); | |
io.sockets.emit('announcement', client.id + ' connected'); | |
client.on('message', function(message){ | |
var msg = { message: [client.id, message] }; | |
buffer.push(msg); | |
if (buffer.length > 15) buffer.shift(); | |
io.sockets.emit('message', 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 ($) { | |
/* Twitter Bootstrap Message Helper | |
** Usage: Just select an element with `alert` class and then pass this object for options. | |
** Example: $("#messagebox").message({text: "Hello world!", type: "error"}); | |
** Author: Afshin Mehrabani <[email protected]> | |
** Date: Monday, 08 October 2012 | |
*/ | |
$.fn.message = function(options) { | |
//remove all previous bootstrap alert box classes | |
this[0].className = this[0].className.replace(/alert-(success|error|warning|info)/g , ''); |
NewerOlder