Skip to content

Instantly share code, notes, and snippets.

View joaoh82's full-sized avatar

João Henrique Machado Silva joaoh82

View GitHub Profile
Follow me on Youtube: https://www.youtube.com/@pacingjosh
Initial Prompt:
You are a professional running coach with extensive experience in training individuals of all levels, from beginners to marathon runners. Your expertise includes creating customized training plans that take runners from zero to marathon readiness in 20 weeks more or less.
You understand the importance of pacing, distance, number of runs per week, rest days, and cross-training to prevent injury and optimize performance.
You analyze data from running platforms like Garmin App to provide personalized advice on pacing, based on factors like previous run times, heart rate zones, elevation, and overall performance trends. Using that data, you can adjust training plans dynamically, helping runners improve their speed, endurance, and recovery.
Your coaching style is supportive, adaptive and brutally honest, ensuring that runners stay motivated and injury-free while progressively reaching their goals. You provide weekly training plans, deta
@joaoh82
joaoh82 / sqlrite-error-mod-part2.rs
Created February 23, 2021 09:33
SQLRite - error module - Part 2
use thiserror::Error;
use std::{result};
use sqlparser::parser::ParserError;
pub type Result<T> = result::Result<T, SQLRiteError>;
#[derive(Error, Debug, PartialEq)]
pub enum SQLRiteError {
@joaoh82
joaoh82 / sqlrite-sql-parser-create-mod-part2.rs
Created February 23, 2021 08:51
SQLRite - sql::parser::create module - Part 2
use sqlparser::ast::{ColumnOption, DataType, ObjectName, Statement};
use crate::error::{SQLRiteError, Result};
// Represents Columns in a table
#[derive(PartialEq, Debug)]
pub struct ParsedColumn {
pub name: String,
pub datatype: String,
pub is_pk: bool,
@joaoh82
joaoh82 / sqlrite-sql-module-part2.rs
Created February 23, 2021 08:07
SQLRite - sql module - Part 2
mod parser;
pub mod tokenizer;
use parser::create::{CreateQuery};
use sqlparser::ast::{Statement};
use sqlparser::dialect::SQLiteDialect;
use sqlparser::parser::{Parser, ParserError};
use crate::error::{SQLRiteError, Result};
@joaoh82
joaoh82 / sqlrite-meta-command.rs
Created February 22, 2021 21:58
SQLRite - meta_command/mod.rs - Part 2
use crate::error::{Result, SQLRiteError};
use std::fmt;
#[derive(Debug, PartialEq)]
pub enum MetaCommand {
Exit,
Help,
Open(String),
Unknown,
@joaoh82
joaoh82 / sqlrite-main-part2.rs
Created February 22, 2021 20:56
SQLRite - main.rs - Part 2
extern crate clap;
mod meta_command;
mod repl;
mod sql;
mod error;
use repl::{REPLHelper, get_config, get_command_type, CommandType};
use meta_command::{handle_meta_command};
use sql::{process_command};
@joaoh82
joaoh82 / rust-sqlite.sh
Created February 15, 2021 18:55
rust-sqlite.sh
$ ./rust_sqlite
Rust-SQLite - 0.1.0
Enter .exit to quit.
Enter .help for usage hints.
Connected to a transient in-memory database.
Use '.open FILENAME' to reopen on a persistent database.
rust-sqlite | 1> random command;
Error: unknown command or invalid arguments: 'random command;'. Enter '.help'
rust-sqlite | 2> .exit
$
@joaoh82
joaoh82 / rust-sqlite-repl-module-part1.rs
Last active February 15, 2021 22:04
Rust-SQLite - repl/mod.rs - Part 1
use std::borrow::Cow::{self, Borrowed, Owned};
use rustyline_derive::{Helper, Completer};
use rustyline::error::ReadlineError;
use rustyline::config::OutputStreamType;
use rustyline::{CompletionType, Config, Context, EditMode};
use rustyline::validate::{MatchingBracketValidator, Validator};
use rustyline::validate::{ValidationContext, ValidationResult};
use rustyline::hint::{Hinter, HistoryHinter};
use rustyline::highlight::{Highlighter, MatchingBracketHighlighter};
@joaoh82
joaoh82 / rust-sqlite-main-part1.rs
Created February 15, 2021 18:12
Rust-SQLite - main.rs - Part 1
extern crate clap;
mod repl;
use repl::{REPLHelper, get_config};
use rustyline::error::ReadlineError;
use rustyline::{Editor};
use clap::{App, crate_version};
package gocontext
import (
"context"
"net/http"
)
type SomeMiddleware interface {
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler)
}