Skip to content

Instantly share code, notes, and snippets.

View richard-ramos's full-sized avatar
👷‍♂️

richΛrd richard-ramos

👷‍♂️
View GitHub Profile
@richard-ramos
richard-ramos / README.md
Created February 17, 2017 18:03 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@richard-ramos
richard-ramos / ethereum1.txt
Created May 29, 2017 03:00
Programando en Ethereum (parte1)
=== Instalacion de geth ====================================
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
pragma Solidity ^0.4.2;
contract Sample {
//state variables
uint256 data;
address owner;
//event definition
event logData(uint256 dataToLog);
@richard-ramos
richard-ramos / ethereum2.txt
Created June 16, 2017 23:39
Programando en Ethereum (parte2) - privnet
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"gasLimit": "210000",
"difficulty": "20000",
"alloc": {
@richard-ramos
richard-ramos / ethereum2b.txt
Created June 16, 2017 23:45
Programando en Ethereum (parte2) - Instrucciones
=== Crear una nueva cuenta en geth ====================================
geth --datadir ~/privnet account new
=== Iniciar consola de JS en geth =====================================
geth attach /home/cham0/privnet/geth.ipc
@richard-ramos
richard-ramos / main.js
Last active June 21, 2019 16:47
Circular Dependencies
let configs = {
"A": ["B", "D"],
"B": ["D"],
"E": ["D"],
"F": ["E", "A"],
"C": [],
"D": []
}
const edges = {};
@richard-ramos
richard-ramos / p2sh_p2wsh.rb
Created December 28, 2019 23:15 — forked from pierrenoizat/p2sh_p2wsh.rb
Generate a P2SH-P2WSH address, create a tx spending from it.
require 'btcruby'
require 'bitcoin'
require 'active_support'
require 'active_support/core_ext'
require 'ffi'
# Creation of Witness Script: here a 2-of-2 multisig as an example
@public_key = "02530c548d402670b13ad8887ff99c294e67fc18097d236d57880c69261b42def7"
@user_key = BTC::Key.new(public_key:BTC.from_hex(@public_key))
@richard-ramos
richard-ramos / transactionbatcher.sol
Created January 24, 2020 14:48
TransactionBatcher
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract TransactionBatcher {
function batch(address payable[] memory to, uint[] memory value, bytes[] memory data) payable public {
uint cnt = to.length;
require(cnt == value.length && cnt == data.length, "Invalid input length");
uint currValue = msg.value;
@richard-ramos
richard-ramos / babel-webpack.md
Created January 31, 2020 14:33 — forked from ncochard/babel-webpack.md
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@richard-ramos
richard-ramos / babel-webpack.md
Created January 31, 2020 14:33 — forked from ncochard/babel-webpack.md
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.