Skip to content

Instantly share code, notes, and snippets.

View martinkuba's full-sized avatar

Martin Kuba martinkuba

View GitHub Profile
{
"http://agile.coffee/#2f83c1c1-918c-4c78-8671-194b2e9d8e54": {
"StatusCode": 206,
"LastSeen": "2023-06-30T11:47:35.371736-04:00"
},
"http://agile.coffee/#3716060f-183a-4966-8da4-60daab2842c4": {
"StatusCode": 206,
"LastSeen": "2023-06-30T09:39:08.307606-04:00"
},
"http://agile.coffee/#b3b37364-d40e-4029-847c-8ee059d60855": {
@martinkuba
martinkuba / events.js
Last active October 16, 2017 16:42
Log events
// wrap addEventListener calls
wrapEventListener(document)
wrapEventListener(window)
// keep track of
var events = []
function logEvent(name, context) {
var found = false
events.forEach(function(e) {
if (e.name === name && e.context === context) {
@martinkuba
martinkuba / index.js
Created September 25, 2017 03:44
inspect object
// show properties
for (var key in obj) {
console.log(key)
var val = obj[key]
if (!val) {
val = '** undefined **'
} else if (typeof val === 'object') {
val = '** function **'
} else if (typeof val === 'function') {
val = '** object **'
@martinkuba
martinkuba / example-consumer-1.js
Created August 17, 2017 19:35
New Relic Node Agent - message instrumentation examples
// This example shows using custom instrumentation function.
// The kafka module is instrumented in a central place, separately from the app
// that uses it.
const newrelic = require('newrelic')
const instrumentKafkaClient = require('./kafka-client-instrumentation')
// register instrumentation for the kafka client module
newrelic.instrumentMessages('./mock-kafka-client', instrumentKafkaClient,
function handleError(err) {
// this is called when the instrumentation itself errors
beforeEach(module(function($provide) {
$provide.factory('$httpBackend', function(){
return angular.injector(['ng']).get('$httpBackend');
})
}));
var node = {
next: null,
value: null,
create: function(value, next) {
var inst = Object.create(this);
inst.value = value;
inst.next = next;
return inst;
}
};
@martinkuba
martinkuba / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console