Skip to content

Instantly share code, notes, and snippets.

View jkrems's full-sized avatar
Modules. Modules everywhere.

Jan Olaf Martin jkrems

Modules. Modules everywhere.
View GitHub Profile
@jkrems
jkrems / gofer-v3.md
Last active April 19, 2016 21:10
Gofer v3

Gofer v3

The following is just a proposal & not yet finished.

The biggest change in 3.x is that gofer no longer uses request behind the scenes. Also we're trying to align the interface more closely with fetch. Whenever we return a promise, it will be Bluebird-flavored.

Simple fetch-style usage:

@jkrems
jkrems / npub.md
Last active November 13, 2015 22:10
Make `npub` great again

npub publish [ <version> ]

Options:

  • -t/--test command - alternate test suite command. default: npm test
  • <version> - 1.2.3; or, for auto increments: patch, minor, major
  • If <version> is not specified, npub will try to deduce it from the Github PRs that were merged, using semver-minor style labels.
  1. Verify: No uncommitted changes
  2. Switch to release branch
@jkrems
jkrems / base.js
Last active October 13, 2015 17:38
(Potential) Groupon Javascript Styles, based on https://github.com/airbnb/javascript
{
// babel-style base rules
"extends": "airbnb/base",
"rules": {
// This allows things like `reduce((a, b) => a + b)`
// Not 100% sure if that's worth the potential cost of badly named identifiers
"id-length": 0
}
}

Manual linking together of -wd and -core:

import initTestium from 'testium-core';
import createDriver from 'testium-driver-wd';
import {test} from 'tap';

test('my test', async t => {
  let b = await initTestium().then(createDriver);
  await b.navigateTo('/foo');
@jkrems
jkrems / node-v4.sh
Created September 9, 2015 19:02
node 4 recipe
VERSION=$1
PACKAGE_TAG=node-${VERSION}
curl -sSo ${PACKAGE_TAG}-linux-x64.tar.gz "https://nodejs.org/dist/${VERSION}/${PACKAGE_TAG}-linux-x64.tar.gz"
tar -xzf ${PACKAGE_TAG}-linux-x64.tar.gz
mv ${PACKAGE_TAG}-linux-x64 ${PACKAGE_TAG}
./${PACKAGE_TAG}/bin/node -v
rm ${PACKAGE_TAG}/README.md ${PACKAGE_TAG}/CHANGELOG.md ${PACKAGE_TAG}/LICENSE
tar -cvzf ${PACKAGE_TAG}.tar.gz ${PACKAGE_TAG}
curl --upload-file $PACKAGE_TAG.tar.gz http://config/package/$PACKAGE_TAG.tar.gz
@jkrems
jkrems / trailing-whitespace.diff
Created August 20, 2015 17:48
Devtools doesn't format JSON responses when they have trailing whitespace
diff --git a/Source/devtools/front_end/network/RequestJSONView.js b/Source/devtools/front_end/network/RequestJSONView.js
index f88c212..a5b3eed 100644
--- a/Source/devtools/front_end/network/RequestJSONView.js
+++ b/Source/devtools/front_end/network/RequestJSONView.js
@@ -152,7 +152,7 @@ WebInspector.RequestJSONView.parseJSON = function(text)
text = text.substring(inner.start, inner.end + 1);
// Only process valid JSONP.
- if (suffix.length && !(suffix.trim().startsWith(")") && prefix.trim().endsWith("(")))
+ if (suffix.trim().length && !(suffix.trim().startsWith(")") && prefix.trim().endsWith("(")))
@jkrems
jkrems / bisector.sh
Last active January 8, 2016 19:55
CLS failure on iojs >= 1.8.4 (possibly earlier)
#!/usr/bin/env bash
./configure
make -j4
./iojs cls-failure.js
@jkrems
jkrems / a-minimal.zb
Last active August 29, 2015 14:24
Minimal interesting Zoidberg program
getName() {
&"Quinn";
}
# Result:
#
# async function getName() {
# return Promise.resolve("Quinn");
# }
@jkrems
jkrems / edge-case.diff
Last active August 29, 2015 14:23
Edge case for node-inspector NetworkAgent
diff --git a/test/NetworkAgent.js b/test/NetworkAgent.js
index f63309b..0d21572 100644
--- a/test/NetworkAgent.js
+++ b/test/NetworkAgent.js
@@ -177,6 +177,15 @@ describe('NetworkAgent', function() {
commandlet.stdin.write('send GET request\n');
});
+
+ xit('should report queued requests', function(done) {
INFO [2015-03-16 22:25:39,674] com.groupon.paywithgroupon.steno.StenoServletFilter: {"time":"2015-03-16T22:25:39.674Z","name":"http.in.start","level":"info","data":{"context":{"transactionId":"705d975e-0ab4-4299-8950-54323a57e5b1"}}}
INFO [2015-03-16 22:25:39,789] com.groupon.paywithgroupon.steno.StenoJaxRsFilter: {"time":"2015-03-16T22:25:39.778Z","name":"http.out.start","level":"info","data":{"method":"GET","url":{"protocol":"http","host":"orders-read-proxy1-staging.snc1","port":-1,"path":"/tps/v1/users/d6b37100-c9c2-11e4-a073-52540a145061/billing_records","query":"use_consumer_id=true"},"groupId":"dd617031-258e-4da0-8229-efdd73addd2d","service":"orders","resource":"billingRecords","action":"getForConsumer","context":{"transactionId":"705d975e-0ab4-4299-8950-54323a57e5b1"}}}
INFO [2015-03-16 22:25:40,275] com.groupon.paywithgroupon.steno.StenoJaxRsFilter: {"time":"2015-03-16T22:25:40.275Z","name":"http.out","level":"info","data":{"method":"GET","url":{"protocol":"http","host":"orders-read-proxy1-staging.