Skip to content

Instantly share code, notes, and snippets.

View patrixd's full-sized avatar

Patricia Juárez Muñoz patrixd

View GitHub Profile
@patrixd
patrixd / bindAll.js
Last active December 31, 2015 18:22
BindAll from underscore that allows 1 argument to bind all the functions from the prototype, or if there are more arguments they will be the only binded
//bindAll from underscore that allows 1 argument to bind all the functions from the prototype,
//or if there are more arguments they will be the only binded
_.originalBindAll = _.bindAll;
_.bindAll = function (that) {
var funcs = Array.prototype.slice.call(arguments, 1),
validKeys = [], fn;
if (funcs.length == 0) {
for (var i in that) {
fn = that[i];
if (fn && typeof fn == "function" && (!fn.prototype || _.keys(fn.prototype).length == 0))
@patrixd
patrixd / jquery.event.touch.doubleTab.js
Last active March 27, 2016 22:04
If you don't use jquery mobile because you think that you don't need all the features, I usually add plugins like the next one. In this case is doubleclick for touchable devices
// Example: this.$stage.doubleTab.on(this.$stage, this.onContainerClicked, 200, "touchstart", this.options.delegatedTagSel);
// this.$stage.doubleTab.off(this.$stage, "touchstart");
$.fn.doubleTab = (function() {
var timer, data, eventType = "touchend";
var timeout = 600;
var $itemClicked = null;
var onDoubleClickSTART = function(e) {
data = e.data;
data.$container.off(data.eventType, onDoubleClickSTART);
@patrixd
patrixd / AppConfig.as
Last active December 17, 2015 09:19
Basic example using Robotlegs2 and Starling. Note: to use Inject in Robotlegs, the class that use them must exist in the context. It was weird to me because I came of Parsley. In Parsley you only declare what to inject you do not declare who inject them too. This example also has an splash in pure actionscript.
package {
// imports ...
public class AppConfig implements IConfig
{
[Inject]
public var context:IContext;
[Inject]
public var commandMap:ISignalCommandMap;