Skip to content

Instantly share code, notes, and snippets.

Kamil Ogórek kamilogorek

Block or report user

Report or block kamilogorek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View log_leaking_4-6-6.txt
npm run test-leaking
> sentry-jest-leak-repro@1.0.0 test-leaking /Users/kirill/Idea/sentry-jest-leak-repro
> jest leaking --maxWorkers=1 --logHeapUsage --detectOpenHandles
PASS src/leaking/488.leaking.test.js (60 MB heap size)
PASS src/leaking/399.leaking.test.js (55 MB heap size)
PASS src/leaking/31.leaking.test.js (55 MB heap size)
PASS src/leaking/136.leaking.test.js (57 MB heap size)
PASS src/leaking/270.leaking.test.js (68 MB heap size)
View standing-desk-timer.go
package main
import (
"fmt"
"os"
"os/exec"
"strconv"
"time"
)
View ex1.go
func ExtractStacktrace(err error) *Stacktrace {
// https://github.com/pkg/errors
// Packages definitions:
// type Frame []uintptr
// type StackTrace []Frame
type stackTracer interface {
StackTrace() errors.StackTrace
}
View 1939.js
const express = require("express");
const Sentry = require("@sentry/node");
const api = express();
Sentry.init({
dsn: "http://whatever@sa.com/12",
environment: "development",
beforeSend(event) {
console.log("beforeSend", event.user.id);
View async-flush.js
const Sentry = require("@sentry/node");
const DELIVERY_TIME = process.argv[2];
const TIMEOUT = process.argv[3];
console.log(`\nDelivery time: ${DELIVERY_TIME / 1000}s`);
console.log(`Timeout: ${TIMEOUT / 1000}s`);
// @ignore-start Helper function
async function sleep() {
View broken-filter.js
window.GoogleCdn = {}
window.GoogleCdn.inject = function () {
internalMethod()
}
function internalMethod () {
throw new Error('dupa')
}
View mirko-vim.js
const entrySelector = "#itemsStream > .entry";
const entries = document.querySelectorAll(entrySelector);
const outlineStyle = "2px solid rgba(108, 176, 221, 0.8)";
const activeClassName = "vimLikeActive";
document.addEventListener("keypress", evt => {
if (document.activeElement !== document.body) return;
if (evt.key === "j") return down();
if (evt.key === "k") return up();
});
View external-lib.js
function externalLibrary (date) {
throw new Error(`externalLibrary method broken: ${date}`);
}
externalLibrary(Date.now());
View lib.js
function externalLibrary (date) {
throw new Error(`externalLibrary method broken: ${date}`);
}
externalLibrary(Date.now());
@kamilogorek
kamilogorek / spell-run.js
Created Jun 14, 2017
Calculate spell damage code kata
View spell-run.js
const { damage } = require("./spell");
console.assert(2 === damage("feeai")); // == 2
console.assert(7 === damage("feaineain")); // == 1 + 2 + 2 + 2 = 7 (fe-ai-ne-ai) - not (fe-ain-ai) because 1+3+2 = 6 and 7 > 6
console.assert(0 === damage("jee")); // == 0
console.assert(0 === damage("fefefefefeaiaiaiaiai")); // == 0 (more than one 'fe')
console.assert(1 === damage("fdafafeajain")); // == 1 (fe-ai) 3 - 2 (because 'aj')
console.assert(0 === damage("fexxxxxxxxxxai")); // == 0 (3-10 = -7 < 0)
You can’t perform that action at this time.