Skip to content

Instantly share code, notes, and snippets.

@iadvize
iadvize / runOnce.js
Created March 18, 2011 17:11
a fonction to run some code no more than 1 time per period
function runOnce(wait, cb){
var timeOut = null
, launched = false;
return function(){
if (launched === false){
launched = true;
cb(arguments);
}
if(timeOut){
@iadvize
iadvize / tropo.php
Created January 17, 2011 21:48
tropo app test in php
<?php
//header('Content-type:application/json');
header("Content-type: text/html; charset=utf-8");
@include '../../inc/env.inc.php';
include '../../inc/db.inc.php';
include '../../inc/functions.inc.php';
session_start();
Strophe.addConnectionPlugin("xdomainrequest", {
init: function() {
if (window.XDomainRequest) {
Strophe.debug("using XdomainRequest for IE");
// override thee send method to fire readystate 2
XDomainRequest.prototype.send = (function(oldSend) {
return function() {
oldsend.apply(this, arguments);
this.readyState = 2;
@iadvize
iadvize / strophe.xdomainrequest.js
Created January 6, 2011 11:15
A Strophe plugin by iAdvize that use the XdomainRequest if found (Internet Explorer)
Strophe.addConnectionPlugin("xdomainrequest", {
init: function () {
if (window.XDomainRequest) {
Strophe.debug("using XdomainRequest for IE");
// override thee send method to fire readystate 2
XDomainRequest.prototype.oldsend = XDomainRequest.prototype.send;
XDomainRequest.prototype.send = function() {
XDomainRequest.prototype.oldsend.apply(this, arguments);
this.readyState = 2;
@iadvize
iadvize / strophe.receipts.js
Created November 25, 2010 18:36
a strophe plugin implementing XEP-0184
Strophe.addConnectionPlugin('receipts', {
_conn: null,
_msgQueue: {},
_retries: {},
_resendCount: 10,
_resendTime: 9000,
init: function(conn) {
this._conn = conn;
Strophe.addNamespace('RECEIPTS', 'urn:xmpp:receipts');