View gist:4264971
(function(){ | |
document.addEventListener("drop", function( e ) { | |
e.preventDefault(); | |
var blob = e.dataTransfer.files[0].slice(); | |
var binaryReader = new FileReader(); | |
$('.req').removeClass('.req'); | |
binaryReader.addEventListener("load", function( file ) { | |
var notFound = ''; | |
file.target.result.trim().replace(/==.*/g,'').split(/\n/).forEach(function(pack){ |
View New_Bind.js
// New methods for all functions: mixapply, mixcall, and mixbind | |
// Allows you to force arguments and context even after using .bind | |
// To skip any argument you can use NULL | |
// License: Public Domain | |
(function () { | |
var __bind = Function.prototype.bind; | |
var toArray = function (a) { | |
return Array.prototype.slice.call(a); | |
}; |
View IE_detection.js
var ie = (function(){ | |
var undef, | |
v = 3, | |
div = document.createElement('div'), | |
all = div.getElementsByTagName('i'); | |
do { | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->'; | |
} while(all[0]); |
View jQuery CDN Fallback example.js
var url = document.location.href; | |
var cdnFallback = /\bcdn=2/.test(url); | |
setTimeout(function(){ | |
if( !window.jQuery && !cdnFallback ) | |
document.location += (/\?/.test(url) ? "&" : "?") + "cdn=2"; | |
},400); | |
if( cdnFallback ){ | |
document.write('<script src="js/jquery-1.8.3.min.js"></scr'+'ipt>'); |
View NoPromises.js
/************** | |
* Con promesas | |
**************/ | |
var promise = foo().then(function(){ | |
var promise = new Promise(); | |
asyncFunction(function(){ | |
// It has to know there is no need to merge it to a received object in order to | |
// do this; | |
var data = {key1:0x111}; |
View gist:4586071
console.log = function(){ return console.__proto__.log.apply(console, arguments) } ; |
View function.sexy_comment.php
<?php | |
/*---------------------------------------------------------------------- | |
|: :| | |
|: Sexy comments in your code! :| | |
|: =========================== :| | |
|: Hi, my name is Ivan I care about programming, music and women. :| | |
|: Follow me on twitter: @ivanca :| | |
|: :| | |
----------------------------------------------------------------------*/ |
View gist:4781307
(function () { | |
var addMethod = function (obj, name, fn) { | |
obj[name] = function () { | |
var undef; | |
var result = fn.apply(obj, arguments); | |
if (result === undef) { | |
result = this; | |
} | |
return result; |
View downs.sublime-macro
[ | |
{ | |
"args": | |
{ | |
"extend": false, | |
"to": "bol" | |
}, | |
"command": "move_to" | |
}, | |
{ |
View Amara Plus.js
// ==UserScript== | |
// @name Amara Plus | |
// @namespace http://rapedinheaven.com | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://www.amara.org/es/onsite_widget/* | |
// @copyright 2012+, You | |
// ==/UserScript== | |
var getByClass = function (sel, parent) { |
OlderNewer