Skip to content

Instantly share code, notes, and snippets.

View Rendez's full-sized avatar

Luis Merino Rendez

View GitHub Profile
document.addEventListener('DOMContentLoaded', Snooper);
function Snooper() {
var stubs = 'track alias name_tag people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user'.split(' ');
var spies = 'track_links track_forms register register_once unregister identify set_config'.split(' ');
var len = 'people.'.length;
var sinonize = function(ctx) {
if (ctx.ua) {
ctx.track_pageview = ctx.ua = sinon.stub(window.mixpanel, 'track_pageview');
@Rendez
Rendez / mixpanel.utm.cookie.renew.js
Last active December 31, 2015 15:08
Mixpanel renew utm codes stored in cookie when option 'store_cookie' = true
//
// Variables
// --------------------------------------------------
// Global values
// --------------------------------------------------
// Grays
// -------------------------
@Rendez
Rendez / multicall-ftp.js
Created July 20, 2011 16:32
Pseudo code multicalling commands FTP node.js
var multicommand = {
"LIST": ["PASV", this.createDataSocket.bind(this)],
"GET": ["PASV", this.createDataSocket.bind(this)],
"PUT": ["PASV", this.createDataSocket.bind(this)],
"RNTO": ["RNFR", this.renameNode.bind(this)]
};
(function(){
@Rendez
Rendez / exception.js
Created July 14, 2011 14:33
Extending JS Error object
/**
* Exception thrown if an error which can only be found on runtime occurs.
*/
var RuntimeError = function(message) {
Error.call(this);
this.type = "RuntimeError";
this.message = message || this.type;
};
/**
@Rendez
Rendez / Array.diff.js
Created January 22, 2011 13:28
Array.diff
Array.implement({
diff: function() {
var r = [], idx = -1, diff, len, i, pos, array, keys;
keys = ((keys = arguments[arguments.length-1]) === true);
while(n < arguments.length) {
array = arguments[n++];
for(len = array.length, pos = this.length; len--;){
for(i = pos; i && (diff = array[len] !== this[--i]););
diff && (r[++idx] = keys ? len : array[len]);
}
var MyTips = new Tips($$('.tooltip'), {
text: null,
fixed: true,
onBound: function(coords){
if (coords.y2) {
this.tip.addClass('reverse');
} else {
this.tip.removeClass('reverse');
}
}
switch(Browser.Engine.name) {
case 'trident':
if(Browser.Engine.version < 4)
return redirect = document.location.href = (URI.base.valueOf()+'browser_detect');
case 'presto':
if(Browser.Engine.version < 960)
return redirect = document.location.href = (URI.base.valueOf()+'browser_detect');
case 'webkit':
if(Browser.Engine.version < 525)
return redirect = document.location.href = (URI.base.valueOf()+'browser_detect');
<xs:redefine schemaLocation="../../../../libs/agavi/config/xsd/_envelope.xsd">
<xs:complexType name="configuration">
<xs:complexContent>
<xs:extension base="configuration">
<xs:group ref="static_files_1_0:configuration" />
<xs:attributeGroup ref="types_1_0:contexts" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<?php
/**
* @package StaticFiles
*
* @author Luis Merino <mail@luismerino.name>
* @copyright Author
*/
class StaticFilesModel extends AgaviModel implements AgaviISingletonModel
{
protected $files = array();