Skip to content

Instantly share code, notes, and snippets.

View shellcatt's full-sized avatar

Krasimir Gruychev shellcatt

View GitHub Profile
@shellcatt
shellcatt / freemind-traverse-match.php
Created February 28, 2023 04:08
FreeMind nodes expander by keyword match
<?php
// Define an array of keywords to search for ... somehow
$keywords = array('term1', 'term2', 'term3');
// Define input & output
$input_file = 'input.mm';
// $output_file = 'output.mm';
// Load the FreeMind XML file
@shellcatt
shellcatt / web3.token-consolidate.lib.js
Last active February 28, 2023 11:47
ETH Token Consolidation
// Get private stuff from my .env file
require('dotenv').config();
const Config = process.env;
// Utils
const fs = require('fs');
const util = require('util');
const BigNumber = require('bignumber.js');
// Ethereum javascript libraries needed
@shellcatt
shellcatt / Ticker.class.js
Last active February 26, 2023 11:52
Ticker
const moment = require('moment');
const util = require('util');
const pause = util.promisify((a, f) => setTimeout(f, a));
export class Ticker {
#timeout = null;
interval = 0; // ms
duration = 0; // ms
@shellcatt
shellcatt / getJSONP.js
Last active February 26, 2023 09:37 — forked from malsup/jsonp
$.getJSONP
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
// figure out what the callback fn is
var $script = $(document.getElementsByTagName('head')[0].firstChild);
var url = $script.attr('src') || '';
var cb = (url.match(/callback=(\w+)/)||[])[1];