Skip to content

Instantly share code, notes, and snippets.

View flavioespinoza's full-sized avatar
😎

Flavio Espinoza flavioespinoza

😎
View GitHub Profile
@flavioespinoza
flavioespinoza / depth_chart.html
Last active April 21, 2023 14:00
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<style>

Keybase proof

I hereby claim:

  • I am flavioespinoza on github.
  • I am flavioespinoza (https://keybase.io/flavioespinoza) on keybase.
  • I have a public key ASBKDaHpFFevPWKGy02d_aXuckg7e5X90k8q4fC9wCQ5uAo

To claim this, I am signing this object:

@flavioespinoza
flavioespinoza / WebsocketSample.js
Last active September 13, 2021 19:31
Bittres Websocket Node.js Authentication Example
/**
* Node.js example
* https://github.com/Bittrex/beta
*
* By Flavio Espinoza
*
* Expanding on example from Adrian Soluch
*
* prerequisites:
* npm i signalr-client crypto lodash ololog
@flavioespinoza
flavioespinoza / cloudSettings
Created October 29, 2019 05:50
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-10-29T05:50:52.835Z","extensionVersion":"v3.4.3"}
@flavioespinoza
flavioespinoza / cloudSettings
Last active February 23, 2020 22:50
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-10T18:33:23.976Z","extensionVersion":"v3.4.3"}

Show JSON with Comments

Render JSON with comments in Github by changing code block language definition from json to jsonc


change this:

@flavioespinoza
flavioespinoza / Types_Integer.ts
Created February 21, 2019 15:56
TypeScript Integer Types
export type Int = number & { __int__: void }
export const roundToInt = (num: number): Int => Math.round(num) as Int
export const toInt = (value: string): Int => {
return Number.parseInt(value) as Int
}
export const checkIsInt = (num: number): num is Int => num % 1 === 0
@flavioespinoza
flavioespinoza / socket_orderbook.js
Created November 10, 2018 06:56 — forked from hitbtc-com/socket_orderbook.js
Socket API example with orderbook
if (typeof WebSocket !== 'function') {
// for node.js install ws package
WebSocket = require('ws');
}
const logger = {
debug: (...arg) => {
// console.log((new Date).toISOString(), 'DEBUG', ...arg)
},
info: (...arg) => {
@flavioespinoza
flavioespinoza / async-await.js
Created October 26, 2018 18:40 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}