Skip to content

Instantly share code, notes, and snippets.

View danazkari's full-sized avatar

Daniel Prado danazkari

View GitHub Profile
@danazkari
danazkari / provision-model.sh
Created October 10, 2017 14:55
LB Models improvement scripts
#!/bin/bash
MODEL=$1
BASE_MODELS_FOLDER="common/models"
MODELS_FOLDER="$BASE_MODELS_FOLDER/$1"
# Infer the name of the model instance to use inside the JS code,
# from the model name in the file: book -> Book, some-model -> SomeModel
MODEL_INSTANCE="$(echo $MODEL | sed -r 's/(^|-)([a-z])/\U\2/g')"
mkdir -p\
$MODELS_FOLDER/remote-hooks\

JS Questions

  • What will this print out and why?
console.log(0.1 + 0.2);
console.log((0.1 + 0.2) === 0.3);
  • Describe what the 'use strict'; expresion does
@danazkari
danazkari / How-to: Loopback with create-react-app.md
Created January 16, 2018 19:39
How-to: Loopback with create-react-app.md

How-To: Loopback with create-react-app

Recommended snack and song:

Have a lovely bowl of rice pudding while listening to [Auto!Automatic!!]

Loopback is amazing at REST API Service, and create-react-app is a neat little CLI that generates a solid starting point for a SPA (single page application). But, putting them together can be... tricky!

Nevertheless, we'll give it a shot.

@danazkari
danazkari / Make Your Own Blockchain (with Hyperledger Fabric).md
Last active July 30, 2022 02:17
Hyperledger Fabric Tutorial [Part 1]: Make Your Own Blockchain.md

Hyperledger Fabric Tutorial [Part 1]: Make Your Own Blockchain

Recommended snack and song:

Sliced bananas and strawberries with granola all mixed in a bowl of natural yogurt while listening to [Royal Blood]

When you hear about blockchain, you normally think of a publicly available ledger, on a worldwide distributed network of peers that have an agreement strategy to include new blocks (or transactions) on the blockchain. This is OK for most applications, but what happens when you need to take advantage of the blockchain technology but don't want your data to be scattered around in the world? What happens when there's sensible data that if made public, could potentially hurt your business interests?

Enter [Hyperledger Fabric]. An open-source blockchain framework implementation hosted by [The Linux Foundation], which you can use to host your very own and very private blockchain. You can read more about it on their website, and perhaps even [watch this intro video] which makes it a bit easier to un

@danazkari
danazkari / Smart Contracts with React (how to be the coolest kid on the block).md
Last active June 6, 2023 20:49
Smart Contracts with React (how to be the coolest kid on the block).md

Smart Contracts with React (how to be the coolest kid on the block)

Recommended snack and song:

220ml of dark roasted full bodied coffee brewed in french press accompanied by a banana while listening to [Liquid Tension Experiment]

tl;dr: You can go ahead and clone [this repo], it's got the end result of this in-depth tutorial bellow.

Here's what we will be doing for becoming smart-contract heroes! - Install the dev environment plus MetaMask. - Develop a very simple voting smart contract.

@danazkari
danazkari / delete-tables.sql
Last active July 28, 2019 20:12
delete tables from public schema postgres
select 'drop table if exists "' || tablename || '" cascade;'
from pg_tables
where schemaname = 'public'; -- or any other schema

Keybase proof

I hereby claim:

  • I am danazkari on github.
  • I am danazkari (https://keybase.io/danazkari) on keybase.
  • I have a public key ASAz-zRTNKYwD6AGbKZURoA3nK9B89W-sdh-LIOmoF4MQwo

To claim this, I am signing this object:

FROM node:12-slim as builder
WORKDIR /usr/src/app
COPY package.json .
COPY yarn*.lock .
RUN yarn --frozen-lockfile
@danazkari
danazkari / bank_usd_crc_mappings.js
Created June 11, 2022 14:03
Bank USD/CRC exchanges mapping to JSON
const getHeaders = (tableRow) =>
Array
.from(tableRow.querySelectorAll('td'))
.map(header => header.innerText);
const getTableRows = (tableElement) =>
Array
.from(
tableElement
.querySelectorAll('tr')
@danazkari
danazkari / machine.js
Last active December 14, 2022 16:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions