Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <libavformat/avformat.h>
#include <libavutil/dict.h>
int main (int argc, char **argv)
{
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *tag = NULL;
int ret;
/**
* @file
* libavcodec API use example.
*
* @example decoding_encoding.c
* Note that libavcodec only handles codecs (MPEG, MPEG-4, etc...),
* not file formats (AVI, VOB, MP4, MOV, MKV, MXF, FLV, MPEG-TS, MPEG-PS, etc...).
* See library 'libavformat' for the format handling
*/
@laalaguer
laalaguer / fomo3d.sol
Created August 2, 2018 03:13
FOMO3D Discussion
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
@laalaguer
laalaguer / ERC20.sol
Created August 28, 2018 05:43
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
pragma solidity ^0.4.24;
import "./ERC20Basic.sol";
/**
* @title ERC20 interface
* @dev Enhanced interface with allowance functions.
* See https://github.com/ethereum/EIPs/issues/20
*/
@laalaguer
laalaguer / main.js
Created March 5, 2019 08:54
Clean up main.js, add some Bootstrap styling
import Vue from 'vue'
import BootstrapVue from 'bootstrap-vue' // Here
import 'bootstrap/dist/css/bootstrap.css' // Here
import 'bootstrap-vue/dist/bootstrap-vue.css' // Here
import App from './App.vue'
Vue.use(BootstrapVue) // Here
Vue.config.productionTip = false
@laalaguer
laalaguer / App.vue
Last active March 5, 2019 11:02
Create an initial component
<template>
<div id="app">
<div>
<b-card style="max-width: 30rem;" header="My Address Here">
<p>My Amount Here <span class="text-primary">VTHO</span></p>
<b-form-group label="To Address:" label-for="toaddress">
<b-form-input id="toaddress" v-model.trim="toaddress"></b-form-input>
</b-form-group>
@laalaguer
laalaguer / operations.js
Created March 5, 2019 09:25
Operations to query balance of VTHO
/**
* Get token amount of holder from a contract.
* @param {String} addressContract 0x started address.
* @param {String} addressHolder 0x started address.
*/
async function getTokenBalance (addressContract, addressHolder) {
const balanceOfABI = {
'constant': true,
'inputs': [
{
@laalaguer
laalaguer / operations.js
Created March 5, 2019 09:35
Add sign-and-send code to the operations.js
/**
* Transfer token from one to another.
* @param {String} addressContract Contract address.
* @param {String} signerAddress Enforce who signs the transaction.
* @param {String} toAddress Receiver of transfer.
* @param {String} amountEVM Big number in string.
* @param {Number} amountHuman Normal number in Javascript.
* @param {String} symbol Symbol of token.
*/
async function transferToken (addressContract, signerAddress, toAddress, amountEVM, amountHuman, symbol) {
@laalaguer
laalaguer / operations.js
Created March 5, 2019 09:45
final touch of operations.js
export {
getTokenBalance,
transferToken
}
@laalaguer
laalaguer / utils.js
Last active March 6, 2019 03:26
Help formatting numbers
const BigNumber = require('bignumber.js')
const DECIMALS = function (points) {
return new BigNumber(10 ** points) // Decimals = 18 on VTHO and most contracts.
}
/**
* Turn a string to big number.
* @param {String} aString a number string.
*/
const makeBN = function (aString) {