Skip to content

Instantly share code, notes, and snippets.

View watson's full-sized avatar

Thomas Watson watson

View GitHub Profile
@watson
watson / error.log
Last active October 28, 2015 16:19
Debugging EBADF in Node.js
(libuv) Failed to create kqueue (24)
(libuv) Failed to create kqueue (24)
events.js:72
throw er; // Unhandled 'error' event
^
Error: write EBADF
at errnoException (net.js:905:11)
at WriteStream.Socket._write (net.js:646:26)
at doWrite (_stream_writable.js:226:10)
@watson
watson / airplay.md
Last active November 5, 2024 23:27
An overview over my AirPlay related modules
@watson
watson / OSaaS.md
Created September 16, 2015 14:11
Open Source as a Service

This is a list of service providers that will help you do better open source software

  • Travis-CI - Continues Integration as a Service
  • CircleCI - Continues Integration as a Service
  • Coveralls - Test Coverage as a Service
  • Codacy - Continuous Static Analysis designed to complement your unit tests
@watson
watson / README.md
Last active August 28, 2024 05:54
A list of search and replace unix commands to help make a node repository 'standard' compliant

The standard code style linter is a great tool by Feross - check it out!

Remove trailing semicolons:

find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/;$//' {} \;

Ensure space between function and opening bracket:

@watson
watson / README.md
Last active August 29, 2015 14:25
A stash of useful unix commands that are too hard to remember, but too useful to forget

Find all files excluding a single directory:

find . -path ./exclude-this -prune -o -type f -name '*.js' -print

Notes:

  • The -path ./exclude-this -prune -o part ensures that the path ./exclude-this isn't included
  • The -print part ensures that the base directory of the excluded path isn't outputtet (this isn't needed if combining with -exec)
@watson
watson / server.js
Last active August 29, 2015 14:25
Example using the async-state module
var http = require('http')
var asyncState = require('async-state')
process.on('uncaughtException', function (err) {
if (asyncState.req) {
console.log('An error occurred while processing request for', asyncState.req.url)
} else {
console.log('An error occurred outside of an HTTP request')
}
})
@watson
watson / console
Created June 18, 2015 17:01
standard fails to fail
~stackman% standard --version
4.3.1
~stackman% standard
~stackman% mkdir /tmp/stackman
~stackman% cp -pr . /tmp/stackman
~stackman% cd /tmp/stackman
~stackman% standard
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
/private/tmp/stackman/err1.js:1:13: Extra semicolon.
/private/tmp/stackman/err1.js:3:29: Extra semicolon.
@watson
watson / isArray.js
Created December 29, 2014 12:06
Node.js util.isArray implementation
function isArray(ar) {
return Array.isArray(ar) ||
(typeof ar === 'object' && objectToString(ar) === '[object Array]');
}
@watson
watson / foo.js
Created October 13, 2014 16:21
JavaScript Array filtering madness
// the data
var arr = ['foo', 'bar', 'baz'];
// the formal way
arr.filter(function (elm) {
return /a/.test(elm);
});
// the one-liner
arr.filter(RegExp.prototype.test.bind(/a/));
@watson
watson / cheatsheet.md
Created October 5, 2014 23:34
ffmpeg cheat sheet

Convert A -> B

Convert and transcode:

ffmpeg -i in.mkv out.mp4

Covert without transcoding: