Skip to content

Instantly share code, notes, and snippets.

View valotvince's full-sized avatar
🚀
Rocketing

Vincent Valot valotvince

🚀
Rocketing
  • Lyon, France
View GitHub Profile
/**
* Override getter and setter for the img DOM element
* so we could change it in our mocked interface
*/
const createElement = document.createElement;
document.createElement = (...args) => {
const element = createElement.apply(document, args);
if (args[0] === 'img') {
@valotvince
valotvince / xhr.proxy.js
Last active January 9, 2023 14:10
XHR ES6 Proxy
import config from './config/xmlhttprequest.config';
const debug = require('debug')('app:xhr-mock');
const XMLHttpRequest = window.XMLHttpRequest;
/**
* Retrieve the mock corresponding to the method / url couple
*
* @param {string} method
* @param {string} url
# Add multimedia source
echo "deb http://http.us.debian.org/debian sid main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://http.us.debian.org/debian sid main non-free contrib" >> /etc/apt/sources.list
apt-get update
# Go to local source directory
cd /tmp
# Become root
su -
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})