Skip to content

Instantly share code, notes, and snippets.

@cowchimp
cowchimp / code.js
Created July 4, 2025 16:04
n8n code node that turns the input json data to a JSONL binary file (single line json object with new line at the end)
const content = $input.item.json.content;
const jsonlString = JSON.stringify(content) + '\n';
const buffer = Buffer.from(jsonlString, 'utf-8');
const binaryData = await this.helpers.prepareBinaryData(
buffer,
'data.jsonl',
'application/jsonl'
);
#include <WiFi.h>
#include <PubSubClient.h>
// a
// ---
// | |
// f | | b
// | |
// --- <----- g
// | |
@cowchimp
cowchimp / client-code.js
Created December 23, 2017 22:35
simple example of how to run js code that was meant to run in a browser context from node
document.addEventListener('DOMContentLoaded', function() {
console.log(window.location.protocol);
});
@cowchimp
cowchimp / .babelrc
Created December 12, 2017 13:25
example of a Jest integration test
{
"presets": ["es2015"]
}
@cowchimp
cowchimp / Readme.md
Last active April 2, 2019 11:50
Resources from the talk "DevTools & Headless Chrome: The Automation Power-Couple"
@cowchimp
cowchimp / Readme.md
Last active June 9, 2017 22:51
"DevTools and Headless Chrome - The Automation Power Couple" talk abstract

Title: DevTools and Headless Chrome - The Automation Power Couple

Abstract:
In this talk we'll see what problems we can fix (or better yet, avoid) by combining two things developers love: Chrome DevTools and automating repetitive tasks.
To do this we'll use a new capability introduced in Chrome 59: running Chrome in "Headless Mode". First off we'll show the powers of each of these tools separately. We'll use DevTools to debug other platforms like node.js and iOS, and we'll use Chrome in Headless Mode to do things like take screenshots, and to scrape sites for data.
Then we'll explore how by combining the two you can make DevTools work for you around-the-clock. We'll cover how to run tests, and set up automatic alerts to catch bugs in your code. We'll also find out how to avoid performance degradation by monitoring everything about your app (amount of unused CSS, memory footprint, etc.)

@cowchimp
cowchimp / .babelrc
Created January 2, 2017 10:55
Trying to understand why `transform-decorators-legacy` isn't working
{
"presets": [
"es2015",
"react"
],
"plugins": [
"syntax-decorators",
"transform-decorators-legacy"
]
}
@cowchimp
cowchimp / package.json
Last active August 29, 2015 14:01
chai as promised not working without `notify`
{
"name": "application-name",
"version": "0.0.1",
"dependencies": {
"q": "*"
},
"devDependencies": {
"mocha": "1.19.0",
"chai": "*",
"chai-as-promised": "*"