Skip to content

Instantly share code, notes, and snippets.

@reazuliqbal
reazuliqbal / sm-cost-estimator.js
Created October 18, 2019 14:22
Calculate how much it costs for a certain level of Splinterlands deck
const tablemark = require('tablemark');
const axios = require('axios');
const editions = [1, 3]; // 0 = Alpha, 1 = Beta, 2 = Promo, 3 = Reward
// Remove splinters you don't want
const splinters = [
'Red', // Fire
'Green', // Earth
'Blue', // Water
/* eslint-disable no-loop-func */
/* eslint-disable no-await-in-loop */
const axios = require('axios');
const callApi = async (endpoint) => {
let result = [];
try {
const { data } = await axios.get(`https://steemmonsters.com/${endpoint}`);
result = data;
const { Client, Asset } = require('dsteem');
const table = require('markdown-table');
const client = new Client('https://anyx.io', { timeout: 30000 });
const users = [];
const refunded = memo => (new RegExp(/Unable to purchase|refund/)).test(memo);
const getTransactions = async (account, start, callback) => {
const wlsjs = require('@whaleshares/wlsjs');
wlsjs.api.setOptions({ url: 'https://rpc.wls.services' });
(async () => {
const username = 'reazuliqbal';
const fortnightAgo = new Date(Date.now() - 12096e5);
const calcTotal = object => (object.reduce((acc, cur) => (parseFloat(cur.pendingPayout) + acc), 0)).toFixed(2);
wlsjs.api.setOptions({url: 'https://rpc.wls.services'});
$(document).ready(async function () {
$('#add-authority').submit(async function (e) {
let username = $('#add-username').val();
let authorized = $('#add-authorized').val();
let role = $('#add-role').val();
let key = $('#add-key').val();
const {
Client,
Signature,
cryptoUtils,
} = require('dsteem');
const client = new Client('https://api.steemit.com');
const args = process.argv.slice(2);
@reazuliqbal
reazuliqbal / curation-rewards.js
Created September 16, 2018 13:34
Save your Curation Rewards sorted by date to a readable JSON file using Node JS
const { Client } = require('dsteem');
const fs = require('fs');
const client = new Client('https://api.steemit.com');
const curationReward = [];
let steemPerMvests = 0;
const getCuration = async (account, start, callback) => {
let lastTrans = start;
@reazuliqbal
reazuliqbal / composer.json
Created February 17, 2018 09:42
Post to Steemit usning PHP
{
"require": {
"t3ran13/php-graphene-node-client": "^3.1"
}
}
function BittrexARB(pair) {
pair = (typeof pair !== 'undefined') ? pair : "BTC-LTC";
var doc = SpreadsheetApp.getActiveSpreadsheet();
var sheet = doc.getSheets()[0];
var response = UrlFetchApp.fetch('https://bittrex.com/api/v1.1/public/getorderbook?market='+ pair +'&type=both');
var data = JSON.parse(response.getContentText());
var row = [];
@reazuliqbal
reazuliqbal / functions.php
Created February 10, 2018 19:14
Querying WordPress serialized ACF meta data using WP_Query
add_action( 'rest_api_init', function () {
// Path to meta query route e.g. localhost:3000/wp-json/reazul/v1/daily_post?for_day=10&for_month=3
register_rest_route( 'reazul/v1', '/daily_post', array(
'methods' => 'GET', // API request method
'callback' => 'get_daily_post', // Call back to process request
'args' => array( // Arguments passed on to the callback and their validations
'for_day' => array(
'required' => true,