Skip to content

Instantly share code, notes, and snippets.

View MauroJr's full-sized avatar
🎯
Focusing

Mauro Junior MauroJr

🎯
Focusing
View GitHub Profile
@MauroJr
MauroJr / ultimate-ut-cheat-sheet.md
Created November 27, 2018 18:47 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


var server = require('net').createServer();
server.listen(5000, function() {
console.log('Telnet server running on port', server.address().port);
});
server.on('connection', function(socket) {
console.log('connected.')
socket.setEncoding('utf8');
var _ = require('underscore'),
util = require('util');
// intercept stdout, passes thru callback
// also pass console.error thru stdout so it goes to callback too
// (stdout.write and stderr.write are both refs to the same stream.write function)
// returns an unhook() function, call when done intercepting
module.exports = function interceptStdout(callback) {
var old_stdout_write = process.stdout.write,
old_console_error = console.error;
var _ = require('underscore'),
util = require('util');
// intercept stdout, passes thru callback
// also pass console.error thru stdout so it goes to callback too
// (stdout.write and stderr.write are both refs to the same stream.write function)
// returns an unhook() function, call when done intercepting
module.exports = function interceptStdout(callback) {
var old_stdout_write = process.stdout.write,
old_console_error = console.error;
var _ = require('lodash'),
util = require('util');
// intercept stdout, passes thru callback
// also pass console.error thru stdout so it goes to callback too
// (stdout.write and stderr.write are both refs to the same stream.write function)
// returns an unhook() function, call when done intercepting
module.exports = function interceptStdout(callback) {
var old_stdout_write = process.stdout.write,
old_console_error = console.error;
var server = require('net').createServer();
server.listen(5000, function() {
console.log('Telnet server running on port', server.address().port);
});
server.on('connection', function(socket) {
// pipe logs to telnet for the duration of connection
var unhookStdout = require('./intercept-stdout')(function intercept(string){
socket.write(string);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form id="form">
<!DOCTYPE html>
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2017 by anonymous (http://jsbin.com/xemiqelalu/1/edit)
Released under the MIT license: http://jsbin.mit-license.org
-->
<meta name="robots" content="noindex">
@MauroJr
MauroJr / whatsapp_phone_enumerator_floated_div.js
Created May 13, 2017 22:16
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part
of your contact list. At the end a table is displayed containing phonenumbers, profile pics,
about texts and online statuses. The online statuses are being updated every
@MauroJr
MauroJr / app.html
Created June 28, 2016 23:43 — forked from Thanood/app.html
Aurelia - Materialize Paging
<template>
<div>
<md-pagination md-pages="6" md-active-page.bind="activePage"></md-pagination>
</div>
<div>
active page: ${activePage}
</div>
</template>