Skip to content

Instantly share code, notes, and snippets.

View Ginden's full-sized avatar

Michał Wadas Ginden

  • Future Mind
  • Warsaw, Poland
View GitHub Profile
// ==UserScript==
// @include https://pl.wikipedia.org/*
// ==/UserScript==
// For test purposes
#include "patcher_x86.hpp"
Patcher* _P;
PatcherInstance* _PI;
static _bool_ plugin_On = 0;
int __stdcall testHook(LoHook* h, HookContext* c)
{
c->eax *= 2;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// ////////
// library library patcher_x86.dll
// spread freely (free of charge)
// copyright: Barinov Alexander (baratorch), e-mail: baratorch@yandex.ru
// the form of implementation of low-level hooks (LoHook) is partly borrowed from Berserker (from ERA)
//////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////
// version 4.2
//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// библиоотека patcher_x86.dll
// распространяется свободно(бесплатно)
// авторское право: Баринов Александр (baratorch), e-mail: baratorch@yandex.ru
// форма реализации низкоуровневых хуков (LoHook) отчасти позаимствована у Berserker (из ERA)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// версия 4.2
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const REALM = Symbol();
Object.define(HTMLElement.prototype, 'realm', {
get() {
if (!Reflect.has(this, REALM)) this[REALM] = window; // Your construction logic goes here
return this[REALM];
}
})
@Ginden
Ginden / AsyncFilter.js
Last active September 21, 2016 10:24
Migrating from callbacks to Bluebird
const fs = require('fs');
const async = require('async');
async.filter(['file1','file2','file3'], function(filePath, callback) {
fs.access(filePath, function(err) {
callback(null, !err)
});
}, function(err, results){
// results now equals an array of the existing files
});
@Ginden
Ginden / package.json
Created August 17, 2016 13:11
Repository Bar
{
"name": "@test/bar",
"version": "0.1.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Michał Wadas",
"license": "MIT",
"dependencies": {
@Ginden
Ginden / package.json
Last active August 17, 2016 13:13
Repository Foo
{
"name": "@test/foo",
"version": "0.1.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Michał Wadas",
"license": "MIT",
"dependencies": {
const BACKING_MAP = Symbol('Backing map for CustomEqualitySet');
const HASH_FUNCTION = Symbol('Hash function for CustomEqualitySet');
export default class CustomEqualitySet extends Set {
constructor(iterable=[], hashFunction=val=>val) {
super();
this[BACKING_MAP] = new Map();
this[HASH_FUNCTION] = hashFunction;
for(const el of iterable) {
this.add(el);