Skip to content

Instantly share code, notes, and snippets.

View cagodoy's full-sized avatar

Camilo Acuña Godoy cagodoy

  • Santiago de Chile
View GitHub Profile
@cagodoy
cagodoy / .go
Created June 29, 2023 13:34
context with timeout
package main
import (
"context"
"errors"
"fmt"
"time"
)
func main() {
@cagodoy
cagodoy / bridge.test.ts
Created March 15, 2022 21:38
Bridge example testing
import { ethers } from "hardhat";
import { use, expect } from "chai";
import { solidity } from "ethereum-waffle";
import { TransactionKind, TransactionStatus } from "../scripts/types";
use(solidity);
describe("Bridge Contract", () => {
let tokenContract, ownerBridgeContract, walletBridgeContract;
let wallet, walletTo;
@cagodoy
cagodoy / bridge.sol
Last active March 15, 2022 21:37
Bridge example implementaton
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "hardhat/console.sol";
interface IERC20WithMintAndBurn is IERC20 {
function mint(address to, uint256 amount) external;
@cagodoy
cagodoy / gist:f56047820a14d5a5914a635a24f8f221
Created April 29, 2019 12:43
progressive image example RN
import React from 'react'
import PropTypes from 'prop-types'
import {
Animated,
View,
Image,
StyleSheet
} from 'react-native'
// import AutoHeightImage from 'react-native-auto-height-image'
<article id="ContainerOne" class="StackedListWrapper StackedListWrapper--sizeLarge StackedListWrapper--axisHorizontal Container">
<header class="StackedListHeader">
<h3 class="Heading Heading--size3 Heading--colorWhite">Container one</h3>
</header>
<ul class="StackedList">
<li class="StackedListItem StackedListItem--isDraggable StackedListItem--item1" tabindex="1">
<div class="StackedListContent">
<h4 class="Heading Heading--size4 text-no-select">zebra</h4>
<div class="DragHandle"></div>
<div class="Pattern Pattern--typeHalftone"></div>
// #include <PID_v1.h>
// include motor
//general status
const String IDLE_STATUS = "idle";
//irrigation status
const String IRRIGATION_STATUS = "irrigation";
const String IRRIGATION_ERROR_STATUS = "irrigation_error";
// #include <PID_v1.h>
// include motor
//general status
const String IDLE_STATUS = "idle";
//irrigation status
const String IRRIGATION_STATUS = "irrigation";
const String IRRIGATION_ERROR_STATUS = "irrigation_error";
const String IRRIGATED_STATUS = "irrigated";
@cagodoy
cagodoy / pubsub.go
Created April 24, 2018 05:32
pubsub try implementation example for golang
// Example
// pubsub := NewPubSub()
// go func() {
// for {
// pubsub.eventListener <- "PING " + string(time.Now().UnixNano())
// time.Sleep(time.Second * 3)
// }
// }()
@cagodoy
cagodoy / mqttAPI.js
Created March 5, 2018 01:57
mqttAPI.js
export default class MQTTAPI {
constructor (options) {
if (options && options.timeout) {
this.timeout = options.timeout
} else {
this.timeout = 3000
}
}
get (client, topic) {