Skip to content

Instantly share code, notes, and snippets.

Francesc Rosas frosas

Block or report user

Report or block frosas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
frosas / index.js
Created Apr 15, 2019
View index.js
const setupGlobalDom = () => {
const originalDocument = global.document;
const originalWindow = global.window;
global.document = jsdom('');
global.window = global.document.defaultView;
return () => {
global.document = originalDocument;
global.window = originalWindow;
frosas /
Last active Nov 4, 2017
Hacker News Comments Filter


Copy/paste index.js into your browser console. Then,

// Non-Angular Javascript contract positions in London or remote
  hn.or(/(javascript|typescript)/i, /ES\d/, 'JS'),
frosas /
Last active Oct 25, 2017
Profiling a Node process using flame graphs

Profiling a Node process using flame graphs

(assuming an Ubuntu machine)


  • Install perf: sudo apt-get install linux-tools-generic
  • Run perf and install any other listed missing package: (e.g.) sudo apt-get install linux-tools-4.4.0-1022-aws linux-cloud-tools-4.4.0-1022-aws
  • Enable symbols mapping when running the Node process: node --perf-basic-prof ...
frosas / index.js
Last active Aug 9, 2017
HN Most Replied Comments
View index.js
// Shows only the most replied comments in post and
// comment pages.
(() => {
const INDENT_WIDTH = 12; // TODO Detect it automatically?
class CommentTreeNode {
constructor(attrs) {
this.children = [];
frosas /
Created Jan 7, 2014
Use static node/npm if system one is not new enough (WIP)
# Make sure we have an up to date node/npm
if [[ $(echo -e "$NODE_VERSION\n$(node -v)" | sort -n | tail -n1) == $NODE_VERSION ]]; then
    wget -q$NODE_VERSION/$NODE_DIR.tar.gz -O - | tar xzf -
    export PATH=$(cd ./$NODE_DIR/bin && pwd):$PATH
View PerProcessConnectionFactory.php
namespace Acme\Bundle;
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
class PerProcessConnectionFactory extends ConnectionFactory
View main.user.js
// ==UserScript==
// @name Toggl Icon
// @namespace
// @version 0.2.3
// @description Shows whether tracking is running in the page icon
// @match
// @copyright 2012, Francesc Rosàs
// ==/UserScript==
var onElementAttributesChange = function(element, callback) {
frosas / 1 -
Created Oct 18, 2012
Toggl Icon & Shortcuts
View 1 -
View 0

This is a title

Blah blah blah

echo "I'm PHP code";
View L'espolímetre.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" itemscope itemtype="">
<meta name="google-translate-customization" content="841cbb2f7ac68e56-c7736918c48b17ea-g517e77c253acdd64-22"></meta>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="L'espolímetre, el contador universal d'espoli espanyol a Catalunya." />
<meta name="keywords" content="espoli, espoli fiscal, espanyaensroba, #espanyaensroba, Independencia, Catalunya, països catalans, ccn" />
<meta property="og:title" content="L'espolímetre"/>
You can’t perform that action at this time.