Skip to content

Instantly share code, notes, and snippets.

View marcelduran's full-sized avatar

Marcel Duran marcelduran

  • Google Inc.
  • SF Bay Area
View GitHub Profile
@marcelduran
marcelduran / brownnoise.sh
Created September 28, 2017 17:19
Brown background noise
play -q -c 2 -n synth brownnoise gain -35
@marcelduran
marcelduran / bookmarklet.js
Last active June 27, 2016 20:43
Fotolog Image Dump
javascript:(function(){var a=document.createElement("iframe"),c=[];a.addEventListener("load",function(){var d=Array.prototype.slice.call(a.contentWindow.document.querySelectorAll(".wall_img_container img"));c=c.concat(d.map(function(a){return a.src}));if((d=Array.prototype.slice.call(a.contentWindow.document.querySelectorAll("#pagination a")).filter(function(a){return">"==a.innerHTML})[0])&&">"==d.innerText)d.click();else{a.parentNode.removeChild(a);var b=document.createElement("a");document.body.appendChild(b); var e=c.length.toString().length,f=Array(e).fill("0").join("");c.forEach(function(a,c){b.href=a.replace("_t.jpg","_f.jpg");b.innerText=b.download="img_"+(f+c).slice(-e)+".jpg";b.click()});b.parentNode.removeChild(b)}});a.src=location.href;document.body.appendChild(a)})();
@marcelduran
marcelduran / markdown.js
Created September 25, 2014 23:47
WebPagetest-API command/options mapping to MarkDown
var map = require('./lib/mapping');
const
TPL_CMD_TITLE = '#### NAME (works for CMDS commandPLURAL)',
TPL_CMD_KEY = '-KEY, ',
TPL_CMD_PARAM = ' _\\<PARAM\\>_',
TPL_CMD_OPT = '* **KEY--NAME**PARAM: INFO';
function caps(word) {
return word[0].toUpperCase() + word.slice(1);
@marcelduran
marcelduran / with_cdns.tap
Created August 4, 2014 17:04
YSlow+PhantomJS TAP output for redfin.com
TAP version 13
1..24
ok 1 A (91) overall score
not ok 2 F (48) ynumreq: Make fewer HTTP requests
---
message: This page has 16 external Javascript scripts. Try combining them into one.
...
ok 3 B (80) ycdn: Use a Content Delivery Network (CDN)
---
message: There are 2 static components that are not on CDN. <p>Using these CDN hostnames from your preferences: img.cdn-redfin.com</p>
<!doctype html>
<html>
<head>
<script>foo = 'iframe'</script>
</head>
<body>
<iframe src="index.html"></iframe>
</body>
</html>
@marcelduran
marcelduran / screenxote.js
Created June 26, 2014 04:24
Screenxote, screenshot of page regions
var args = require('system').args,
page = require('webpage').create();
// valid options
var opts = {
'v': 'viewport',
'a': 'area',
's': 'selector',
'o': 'output',
'c': 'custom'
@marcelduran
marcelduran / app.js
Created June 26, 2014 04:14
defer.me
require('http').createServer(function(req,res){
console.log(req.headers['user-agent']);
res.writeHead(200, {
'Content-Type': 'text/css',
//'Cache-Control': 'private, max-age=' + 60*60*24*365*10,
//'Expires': new Date(new Date().getTime()+(1000*60*60*24*365*10)).toUTCString(),
'Vary': 'Accept-Encoding'
});
/*res.end(); return;*/
var d = new Date();
@marcelduran
marcelduran / gist:1e91b64849e4c0572de2
Created May 14, 2014 18:09
PhantomJS script to pseudo-retina screenshots
var page = require('webpage').create(),
address, output, size;
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg);
};
if (phantom.args.length < 2 || phantom.args.length > 6) {
console.log('Usage: rasterize.js URL filename WxH retina ua');
phantom.exit();
@marcelduran
marcelduran / flickr_archive_downloader_browser.js
Last active December 28, 2016 02:18
Flickr archive bulk downloader
var PAD = '00000';
var count = {
all: 0,
day: 0,
single: 0
};
var timer, isFirst, imgs, current;
<!doctype html>
<html>
<head>
<script>console.log('pre css', performance.now());</script>
<link rel="stylesheet" href="http://1.cuzillion.com/bin/resource.cgi?type=css&sleep=2&n=1&t=12345" onload="console.log('css load', performance.now())">
<script>console.log('post css', performance.now());</script>
</head>
<body>
<h1>foo</h1>
<script>console.log('dom', performance.now());</script>