Skip to content

Instantly share code, notes, and snippets.

@thiagosouza
thiagosouza / 0 README.sh
Last active February 14, 2019 18:42
Smart Contracts usando Node.js, web3 e Serverless
mkdir mvp-blockchain-serverless
#install nvm and put a nvmrc file on the directory
touch .nvmrc && echo "8" >! .nvmrc && cd .
#initialize npm package
npm init
npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools
@thiagosouza
thiagosouza / simpletoken.sol
Last active February 27, 2019 17:56
[simpletoken] smart contract based on openzeppelin token implementation
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
@thiagosouza
thiagosouza / 1 setup - nodejs nvm npm firebase.sh
Last active February 25, 2019 20:45
[MVP Blockchain Serverless] #blockchain #serverless #firebase #google-cloud
#node 8
#https://nodejs.org/en/download/
#nvm
#https://github.com/creationix/nvm#install-script
cd /tmp
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
@thiagosouza
thiagosouza / oauth.md
Last active February 19, 2019 02:17
[OAuth]

https://www.oauth.com/

Access Tokens Password Grant 12.2

POST /oauth/token HTTP/1.1
Host: authorization-server.com
 
@thiagosouza
thiagosouza / readme.md
Last active February 19, 2019 17:55
[Swagger API] #swagger #api #firebase #nodejs #middleware
@thiagosouza
thiagosouza / readme.md
Created February 19, 2019 17:58
[lowdb] lowdb Small JSON database for Node, Electron and the browser. Powered by Lodash.

[lowdb] lowdb Small JSON database for Node, Electron and the browser. Powered by Lodash. https://github.com/typicode/lowdb

db.get('posts')
  .push({ id: 1, title: 'lowdb is awesome'})
  .write()
@thiagosouza
thiagosouza / candlestick patterns.pine
Created February 21, 2019 22:15
Candlestick patterns
// Created by Robert N. 030715
// Candle labels
study(title = "Candles", overlay = true)
trend= input(5, minval=1, title="Trend in Bars")
DojiSize = input(0.05, minval=0.01, title="Doji size")
data=(abs(open - close) <= (high - low) * DojiSize)
plotchar(data, title="Doji", text='Doji', color=white)
@thiagosouza
thiagosouza / nodejs nvm npm setup.sh
Last active September 28, 2021 14:49
[Node.js] Node.js Setup with NVM #nodejs #nvm #npm #setup
#node
#https://nodejs.org/en/download/
#nvm
#https://github.com/creationix/nvm#install-script
cd /tmp
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@thiagosouza
thiagosouza / firebase setup.sh
Last active February 28, 2019 03:04
Firebase setup
mkdir mvp-blockchain-serverless && cd $_ #creates a folder for your porject and enter it
touch .nvmrc && echo "8" >! .nvmrc && cd . #install nvm and put a nvmrc file on the directory
npm init #initialize npm package
npm install firebase-functions@latest firebase-admin@latest --save #install firebase tools locally
npm install -g firebase-tools #install firebase tools globally
firebase login #authenticates your computer to manage the firebase project
@thiagosouza
thiagosouza / . index.js
Last active February 28, 2019 04:28
firebase function for ethereum wallet
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
db.settings({ timestampsInSnapshots: true });
const { ethereumAccountCreate } = require("./ethereumAccountCreate");