This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* npm install -g source-map */ | |
var fs = require('fs'); | |
var sourceMap = require('source-map'); | |
var rawSourceMap = fs.readFileSync('./app.js.map').toString(); | |
var smc = new sourceMap.SourceMapConsumer(rawSourceMap); | |
// output original filename, line, column, token for input {line, column} | |
// in built/minified file (e.g. app.min.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(fileInfo, api) { | |
var j = api.jscodeshift; | |
var out = j(fileInfo.source) | |
.find(j.Literal) | |
.forEach(function (path) { | |
// Only consider literals that start/end w/ double quotes | |
if (!/^".*"$/.test(path.value.raw)) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script type="text/javascript">window.jQuery || document.write('<script src="https://cdn3.vox-cdn.com/javascripts/vendor/jquery-1.11.2.min.js"><\/script>');</script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script> | |
<script type="text/javascript">window._ || document.write('<script src="https://cdn0.vox-cdn.com/javascripts/vendor/underscore-1.5.2.min.vd22f881.js"><\/script>');</script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script> | |
<script type="text/javascript">window.Backbone || document.write('<script src="https://cdn3.vox-cdn.com/javascripts/vendor/backbone-1.0.0.min.v3541019.js"><\/script>');</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('img').attr('src', 'http://i2.kym-cdn.com/photos/images/facebook/000/001/582/picard-facepalm.jpg'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Proof of concept ESLint rule for warning about potential | |
* XSS vulnerabilities caused by mixing innerHTML/text node | |
* property access. | |
* | |
* More here: http://benv.ca/2012/10/2/you-are-probably-misusing-DOM-text-methods/ | |
*/ | |
'use strict'; | |
var WARNING_MSG = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ » curl -s -D - https://github.com -o /dev/null ben@Sinclair-2 | |
HTTP/1.1 200 OK | |
Server: GitHub.com | |
Date: Sat, 29 Jun 2013 00:52:59 GMT | |
Content-Type: text/html; charset=utf-8 | |
Connection: keep-alive | |
Status: 200 OK | |
Cache-Control: private, max-age=0, must-revalidate | |
Strict-Transport-Security: max-age=2592000 | |
X-Frame-Options: deny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List of websites that force anonymous visitors to sign in to view content indexed by Google: | |
quora.com | |
estocksdaily.com | |
travelzoo.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute fn for each element in arr, releasing to the UI | |
// thread (via underscore's _.defer) between each execution | |
_.chainedDefer = (function () { | |
function next(arr, fn, scope) { | |
if (!arr.length) | |
return; | |
fn.call(scope, arr.shift()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// no document ready check - put this at the end of <body> | |
;(function() { | |
var pre = Array.prototype.slice.call(document.getElementsByTagName('code')); | |
pre.forEach(function (p) { | |
p.setAttribute('contenteditable', 'true'); | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function forEach(arr, fn) { | |
var impl = fn.toString(); | |
var m = impl.match(/function \((\w+),?\s*(\w+)?\) { (.*) }/); | |
var arg0 = m[1]; | |
var arg1 = m[2]; | |
var body = m[3]; | |
var program = []; | |
program.push('var ' + arg0 + ';'); | |
if (arg1) | |
program.push('var ' + arg1 + ';'); |
NewerOlder