Skip to content

Instantly share code, notes, and snippets.

@MBeliou
MBeliou / bank-execute.ts
Last active June 21, 2023 14:00
This gist provides a collection of files and functions that demonstrate common operations on a cosmos-based blockchain (Including here a setup for the fetch.ai blockchain). It includes essential functionalities such as executing and querying operations for CW20 tokens (fungible tokens), CW721 tokens (non-fungible tokens), and the bank module. Th…
import { SigningStargateClient } from "@cosmjs/stargate";
import {
OfflineSigner,
OfflineDirectSigner,
DirectSecp256k1HdWallet,
} from "@cosmjs/proto-signing";
const rpc = "https://rest-fetchhub.fetch.ai:443";
const address = "fetch17zr49k6tmcz7eezxgl7x0pfxa9e92h7lfw657k";
async function delegateTo(delegatorAddress, validatorAddress, coin) {
import 'dart:html';
import 'package:flutter/material.dart';
void main() {
window.document.onContextMenu.listen((evt) => evt.preventDefault());
runApp(MyApp());
}
class MyApp extends StatelessWidget {
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MouseRegionApp());
}
class MouseRegionApp extends StatelessWidget {
[build]
# The relative path to the directory to be published
publish = "build/web"
# Our Flutter Web build command
command = "if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web"
@MBeliou
MBeliou / TWColor.dart
Created June 22, 2020 13:34
Sample implementation for TWColor
import 'package:flutter/material.dart';
class TWColor extends ColorSwatch<int> {
/// Creates a color swatch with a variety of shades.
///
/// The `primary` argument should be the 32 bit ARGB value of one of the
/// values in the swatch, as would be passed to the [new Color] constructor
/// for that same color, and as is exposed by [value]. (This is distinct from
/// the specific index of the color in the swatch.)
const TWColor(int primary, Map<int, Color> swatch) : super(primary, swatch);
@MBeliou
MBeliou / destination.dart
Last active June 13, 2020 13:54
Make an adaptive Flutter Layout with a truly responsive Scaffold
import 'package:flutter/material.dart';
class Destination {
final Widget widget;
final Icon icon;
final Text title;
Destination(
{@required this.widget, @required this.icon, @required this.title});
@MBeliou
MBeliou / main.dart
Created May 1, 2020 20:28
Generate the tailwindUI colors for flutter
import 'package:flutter/material.dart';
Map<String, Map<String, String>> colors = {
/*
"transparent": "transparent",
"white": "#ffffff",
"black": "#000000",
*/
"gray": {
"50": "#f9fafb",
@MBeliou
MBeliou / main.dart
Last active January 11, 2020 19:40
A flutter text widget in the style of mario 64 box title
import 'package:flutter/material.dart';
import 'dart:math';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@MBeliou
MBeliou / csv_to_mongo.py
Created August 18, 2018 13:41
Go from csv to mongo record
import json
import pandas as pd
df = pd.read_csv('file.csv', header=0, sep=';')
data = json.loads(df.to_json(orient='records'))
# collection.insert(data)
04cc77a20028d963f1338fdd8b2734b4b3fba89ed5c8df72c4c575f3a093c2917b6cc7711704a3d71dee865669722ef5cedeb4b56c558c022b5dff6b6b80fdd76e;romanornr