Skip to content

Instantly share code, notes, and snippets.

View rjmarquez's full-sized avatar

Richard Márquez rjmarquez

View GitHub Profile
@rjmarquez
rjmarquez / simboost.m
Created October 19, 2020 23:54
Simulaciones de Control Avanzado 19/10/2020 514-AB
clear all
close all
global L C bV E R bi bu
L = 1e-3;
C = 300e-6;
R = 100;
E = 10;
bV = 20;
bi = bV^2/R/E;
bu = (bV-E)/bV; # 0.5
@rjmarquez
rjmarquez / mixinheroes.dart
Created May 24, 2020 23:10
Mixins in Dart (from CodingWithJoe)
import "dart:math";
main(List<String> arguments) {
var hulk = Hulk();
print(hulk.helpPersonInNeed());
hulk.move();
hulk.attack();
var ironMan = IronMan();
print(ironMan.helpPersonInNeed());
@rjmarquez
rjmarquez / guitarsencapsulation.dart
Created May 23, 2020 02:22
Enum type and encapsulation in Dart (Head First Object-Oriented Analysis and Design)
enum Builder { FENDER, MARTIN, GIBSON, COLLINGS, OLSON, RYAN, PRS, ANY }
enum Type { ACOUSTIC, ELECTRIC }
enum Wood {
INDIAN_ROSEWOOD,
BRAZILIAN_ROSEWOOD,
MAHOGANY,
MAPLE,
COCOBOLO,
@rjmarquez
rjmarquez / pizzaabstractfactory.dart
Last active May 21, 2020 17:36
(Abstract) Factory Pattern in Dart (From HeadFirst Design Patterns)
abstract class Pizza {
String name;
Dough dough;
Sauce sauce;
List<Veggies> veggies;
Cheese cheese;
Pepperoni pepperoni;
Clams clam;
@rjmarquez
rjmarquez / starbuzz.dart
Last active May 19, 2020 15:43
Decorator Pattern in Dart (HeadFirst Design Patterns)
void main() {
Beverage beverage = new Espresso();
beverage = new ExtraCoffe(beverage);
beverage = new Discount(beverage);
print("${beverage.getDescription()}: \$${beverage.cost().toStringAsFixed(2)}");
Beverage beverage2 = new DarkRoast();
beverage2 = new Mocha(beverage2);
beverage2 = new Mocha(beverage2);
beverage2 = new Whip(beverage2);
@rjmarquez
rjmarquez / weather.dart
Last active April 2, 2025 00:29
Observer Pattern implemented in Dart (HeadFirst Design Patterns - Weather Station example)
void main() {
WeatherData weatherData = new WeatherData();
CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData);
weatherData.setMeasurements(80, 65, 30.4);