Skip to content

Instantly share code, notes, and snippets.

var rfc = RfcBuilder.ForNaturalPerson()
.WithName("Miguel Angel")
.WithFirstLastName("Salazar")
.WithSecondLastName("Test")
.WithDate(1987, 04, 15)
.Build();
@migsalazar
migsalazar / Rfc.cs
Last active June 17, 2016 05:11
Rfc
public class Rfc {
//properties...
private Rfc(string tenDigitsCode, string homoclave, string verificationDigit) {
this.TenDigitsCode = tenDigitsCode;
this.Homoclave = homoclave;
this.VerificationDigit = verificationDigit;
}
private Rfc Build() {
Person person = new Person(this.Name, this.FirstLastName, this.SecondLastName, this.Year, this.Month, this.Day);
string tenDigitsCode = TenDigitsCalculator();
string homoclave = HomoclaveCalculator();
string verificationDigit = VerificationDigitCalculator();
return Rfc.Build(tenDigitsCode, homoclave, verificationDigit);
}
@migsalazar
migsalazar / RfcBuilder.cs
Last active June 17, 2016 04:09
RfcBuilder
public class RfcBuilder {
private string Name;
private string FirstLastName;
//more properties
public RfcBuilder WithName(string name) {
this.Name = name;
return this;
}
Rfc rfc = new Rfc({
Name = "Mig",
FirstLastName = "Salazar",
SecondLastName = "Test",
Date = new DateTime(1987, 4, 15)
});
Rfc rfc = new Rfc("Test", "Salazar", "Miguel" , new DateTime(1987, 4, 15));
Rfc rfc = new Rfc("Miguel", "Salazar", "S", new DateTime(1987, 4, 15));
@migsalazar
migsalazar / index.html
Last active January 6, 2018 20:58
Plotting math functions with Canvas-HTML5
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<canvas id="canvas" height="300px" width="500px">
Your browser doesn't support canvas
</canvas>
@migsalazar
migsalazar / canvas.4.js
Last active June 5, 2016 06:26
Plotting with canvas
var xExists = [0, 2*Math.PI],
f = function(x) {
return 3*Math.sin(x) * Math.cos(x)/2;
};
plot(f, xExists);
@migsalazar
migsalazar / canvas.3.js
Created June 5, 2016 05:31
Plotting with Canvas
context.beginPath();
for (var x = xstart; x < width; x++) {
xreal = (x / (xorigin)) - x0,
yreal = height - ((f(xreal) - y0) * _yscale);
context.lineTo(xreal, yreal);
}