Skip to content

Instantly share code, notes, and snippets.

extern crate rand;
use rand::Rng;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::ops::Sub;
#[derive(Debug)]
enum CellState {
PASSAGE,
Compiling crates_bot v0.1.0 (file:///home/gugah/Development/Rust/crates-bot)
error[E0277]: the trait bound `std::vec::Vec<std::boxed::Box<erased_serde::Serialize>>: std::iter::FromIterator<std::boxed::Box<telebot::objects::InlineQueryResultArticle>>` is not satisfied
--> src/main.rs:43:18
|
43 | .collect();
| ^^^^^^^ a collection of type `std::vec::Vec<std::boxed::Box<erased_serde::Serialize>>` cannot be built from an iterator over elements of type `std::boxed::Box<telebot::objects::InlineQueryResultArticle>`
|
= help: the trait `std::iter::FromIterator<std::boxed::Box<telebot::objects::InlineQueryResultArticle>>` is not implemented for `std::vec::Vec<std::boxed::Box<erased_serde::Serialize>>`
error: aborting due to previous error
@gugahoa
gugahoa / comma_erro.rs
Last active May 27, 2018 04:43
Example breaking global option
#![feature(proc_macro)]
extern crate thunder;
extern crate clap;
use thunder::thunderclap;
struct Loki;
#[thunderclap(example: String: "Error, here")]
impl Loki {
@gugahoa
gugahoa / something.ex
Created June 9, 2018 03:50
get_or_create_category_by_name
defmodule Something do
def get_or_create_category_by_name(name) do
Repo.transaction(fn ->
case Repo.get_by(Category, name: name) do
{:ok, category} ->
category
_ ->
case create_category(%{name: name}) do
{:ok, category} -> category
{:error, error} -> Repo.rollback(error)

Keybase proof

I hereby claim:

  • I am gugahoa on github.
  • I am gustavohoa (https://keybase.io/gustavohoa) on keybase.
  • I have a public key ASDn0aA8zp2KmGTP2cIfopo-4QfRyuT8UBURG0Vd5G_uGQo

To claim this, I am signing this object:

function doubleAfter2Seconds(x) {
return new Promise(resolve => {
setTimeout(() => {
resolve(x*2);
}, 2000);
});
}
async function addPromise(x){
let a, b, c;
Compiling thunder v0.3.1 (file:///home/gustavo.aguiar/git/gugahoa/thunder)
warning: this feature has been stable since 1.29.0. Attribute no longer needed: thunder
--> src/lib.rs:4:12
|
4 | #![feature(proc_macro, proc_macro_lib, iterator_flatten)]
| ^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
warning: proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
[package]
name = "cli-example"
version = "0.1.0"
authors = ["Gustavo Aguiar"]
[dependencies]
thunder = { git = "https://github.com/spacekookie/thunder", rev = "65bf4bc" }
clap = "2.32"
#![feature(use_extern_macros)]
extern crate thunder;
extern crate clap;
use thunder::thunderclap;
struct Wrapper;
#[thunderclap]
impl Wrapper {
#![feature(prelude_import)]
#![no_std]
#![feature(use_extern_macros)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std;
extern crate thunder;
extern crate clap;