Skip to content

Instantly share code, notes, and snippets.

@zlumer
zlumer / html2canvas.js
Last active August 21, 2019 21:01 — forked from andersonfreitas/html2canvas.js
Snippet to load html2canvas in the actual page
this.scriptObject=document.createElement('script');
this.scriptObject.type='text/javascript';
this.scriptObject.src='https://html2canvas.hertzen.com/dist/html2canvas.js';
var ssc = document.getElementsByTagName('script')[0];
ssc.parentNode.insertBefore(this.scriptObject, ssc);
function screenshot(elem)
{
return html2canvas(elem, {logging: true, profile: true, useCORS: true })
}
@zlumer
zlumer / index.html
Last active July 2, 2019 19:12
KLozVj
<body class="layout-boxed navbar-top bg-black">
<div class="flash-messages" style="display: none;">
</div>
<!-- Main navbar -->
<div class="navbar navbar-fixed-top navbar-inverse bg-anco-blue-dark">
@zlumer
zlumer / snippet.ts
Last active March 30, 2019 10:17
web3 transfer tx generation
let tx = (nonce, gasPrice, to, amount) => ({
nonce: Web3.utils.toHex(nonce),
gasPrice: Web3.utils.toWei(gasPrice.toString(), 'gwei'),
gasLimit: "0x5208",
to,
value: Web3.utils.toWei(amount.toString()),
data: "0x",
chainId: 1
})
@zlumer
zlumer / README.md
Last active July 21, 2018 23:00
expload/pravda regression

Contract compiles successfully both in csc and pravda dotnet but fails to deploy on local node.

Stopping abci.socketClient for error: read tcp 127.0.0.1:59507->127.0.0.1:46658: wsarecv: An existing connection was forcibly closed by the remote host. module=abci-client connection=mempool

Compilation:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe poker.cs /reference:../pravda/dotnet/src/test/resources/expload.dll 
@zlumer
zlumer / _demo.md
Last active February 11, 2017 18:57
RPG MO Level up notification

To run the mod, run the code below in the console, I've checked it with the last game version I had (57-4-2-1a).

demo pic

demo pic 2

demo gif

/**
* Передаём веса в формате { potion:200, sword:15, unique_sword:1 }
*/
function getRandom(weights)
{
var total = calculateWeightsTotal(weights); // считаем суммарный вес
var rnd = Math.random() * total; // генерируем случайное число размером с максимальный вес
for (var s in weights)
{
@zlumer
zlumer / dot_preload.js
Last active April 24, 2016 07:06
doT template preloader for browser
(function (doT) {
var templates = {};
var scripts = Array.prototype.slice.call(document.getElementsByTagName('script')); // load all scripts
for (var i = 0; i < scripts.length; i++) { // filter out template script tags
var script = scripts[i];
if (script.type == "text/dot-template") {
var name = script.id || script.getAttribute('name') || script.getAttribute('data-name');
templates[name] = script.innerHTML; // store template for later use
script.parentNode.removeChild(script); // remove template from DOM
}