Skip to content

Instantly share code, notes, and snippets.

:octocat:
#building

Leon Gaban leongaban

:octocat:
#building
Block or report user

Report or block leongaban

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 blockstack
Verifying my Blockstack ID is secured with the address 1KWPiFTX9JFUVcYS9KH1GDMi9AZNHUpgBz https://explorer.blockstack.org/address/1KWPiFTX9JFUVcYS9KH1GDMi9AZNHUpgBz
@leongaban
leongaban / nFormatter.js
Created Mar 3, 2019
Large currency / money number formatter
View nFormatter.js
// https://tinyurl.com/nFormatter
export const nFormatter = (num: number, digits: number) => {
const si = [
{ value: 1, symbol: "" },
{ value: 1E3, symbol: "k" },
{ value: 1E6, symbol: "M" },
{ value: 1E9, symbol: "G" },
{ value: 1E12, symbol: "T" },
{ value: 1E15, symbol: "P" },
{ value: 1E18, symbol: "E" }
@leongaban
leongaban / capitalizeFirstLetter.js
Last active Feb 21, 2019
capitalizeFirstLetter
View capitalizeFirstLetter.js
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
// ES6 & Typescript version:
export const capitalizeFirstLetter = (word: string) =>
word.charAt(0).toUpperCase() + word.slice(1);
View poolApi.test.ts
import LiquidityPoolApi from './LiquidityPool';
const endpoint = '/frontoffice/api/liquidity-pool/get-total-payout';
jest.mock(endpoint, () => ({
getUsersTotalPayout: jest.fn(() => Promise.resolve({ data: { payout: 100.21 } }))
}));
describe('LiquidityPool API: getUsersTotalPayout', () => {
it('should make a request when we get images', () => {
View poolApi.ts
import { bind } from 'decko';
import BaseApi from './Base';
import * as NS from './types';
class LiquidityPoolApi extends BaseApi {
@bind
public async getUsersTotalPayout(userId: string): Promise<number> {
const params: NS.IGetUsersTotalPayoutRequest = { userId };
@leongaban
leongaban / decred-edge-currency-plugin-progress.md
Last active Mar 5, 2018
Guide to setup Decred edge-currency-plugin
View decred-edge-currency-plugin-progress.md
@leongaban
leongaban / coverage.sh
Created Feb 27, 2018
Script to limit your tests coverage check to specific directories
View coverage.sh
#!/usr/bin/env bash
JEST=node_modules/jest/bin/jest.js
HELP_TEXT="\n\n\tPass a target with '-t' or '--target'.\n"
RED='\033[0;31m'
NC='\033[0m' # No Color
POSITIONAL=()
while [[ $# -gt 0 ]]
do
View index.js
// @flow
import type {
AbcCorePluginOptions,
AbcCurrencyInfo,
AbcCurrencyPlugin,
AbcCurrencyPluginFactory
} from 'edge-login'
import bcoin from 'bcoin'
// Coins Plugin Info
View decred.js
// @flow
import type { AbcCurrencyInfo } from 'edge-login'
export const decredInfo: AbcCurrencyInfo = {
// Basic currency information:
currencyCode: 'DCR',
currencyName: 'Decred',
pluginName: 'decred',
denominations: [{ name: 'DCR', multiplier: '100000000', symbol: 'D' }],
walletTypes: ['wallet:decred-blake256', 'wallet:decred'],
@leongaban
leongaban / currencyPlugin.js
Created Feb 23, 2018
Decred currencyPlugin
View currencyPlugin.js
// @flow
import type {
AbcCorePluginOptions,
AbcCurrencyEngine,
AbcCurrencyEngineOptions,
AbcCurrencyInfo,
AbcCurrencyPlugin,
AbcEncodeUri,
AbcIo,
AbcParsedUri,
You can’t perform that action at this time.