Used: q-spec.js@a1a416.
Implementations compared:
This is currently in Q:
/* partial non-enumerable property implementation | |
Adds a flag to a weakmap saying on obj foo property bar is not enumerable. | |
Then checks that flag in Object.keys emulation. | |
*/ | |
// pd.Name :- https://github.com/Raynos/pd#pd.Name | |
var enumerables = pd.Name(); |
javascript:(function(){findSelectionDocument=function(w){if(w.document.getSelection().toString().length>0){return w.document;}for(var i=0;i<w.frames.length;i++){var doc=findSelectionDocument(w.frames[i]);if(doc){return doc;}}return null;};doc=findSelectionDocument(window)||document;timestamp=doc.getSelection().toString().trim();c=doc.getElementById("_canvas");if(c)return;c=doc.createElement("div");c.id="_canvas";c.setAttribute("style","position:fixed;z-index:100;background-color:rgba(25,25,25,.90);top:0px;left:0px;height:100%;width:100%;text-align:center;font-family:monospace, sans-serif;font-size:12px;");c.onclick=function(){this.parentNode.removeChild(this);};w=doc.createElement("div");w.setAttribute("style","background-color:white;padding:20px;margin:100px auto 0;display:inline-block;border-radius:10px;text-align:left;box-shadow:5px 8px 24px -10px black;");w.onclick=function(){event.stopPropagation();};t=doc.createElement("table");t.setAttribute("style","border-collapse:separate;border-spacing:20px 4px;"); |
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http'); | |
var app = express(); | |
var server = app.listen(3000); |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
// Based on https://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js | |
(function( jQuery ) { | |
if ( window.XDomainRequest && !jQuery.support.cors ) { | |
jQuery.ajaxTransport(function( s ) { | |
if ( s.crossDomain && s.async ) { | |
if ( s.timeout ) { | |
s.xdrTimeout = s.timeout; | |
delete s.timeout; |
Used: q-spec.js@a1a416.
Implementations compared:
This is currently in Q:
var http = require('http') | |
, formidable = require('formidable') | |
, fs = require('fs') | |
, qs = require('querystring') | |
, util = require('util') | |
, uploads = {}; | |
http.createServer(function(req, res){ | |
if(req.method == 'GET') { | |
if(req.url != '/favicon.ico') { |
(function( global ) { | |
"use strict"; | |
function isConstructor( C ) { | |
try { | |
new C(); | |
return true; | |
} catch ( e ) { | |
return false; | |
} |
var gm = require('gm'); | |
var canvasWidth = 248; | |
var canvasHeight = 389; | |
gm(__dirname + '/original.jpg').size(function(error, size) { | |
if (error) { | |
console.error(error); |
// encode(decode) html text into html entity | |
var decodeHtmlEntity = function(str) { | |
return str.replace(/&#(\d+);/g, function(match, dec) { | |
return String.fromCharCode(dec); | |
}); | |
}; | |
var encodeHtmlEntity = function(str) { | |
var buf = []; | |
for (var i=str.length-1;i>=0;i--) { |