Skip to content

Instantly share code, notes, and snippets.

View azaharafernandezguizan's full-sized avatar

Azahara Fernández Guizán azaharafernandezguizan

View GitHub Profile
@azaharafernandezguizan
azaharafernandezguizan / DenoPostWorking.ts
Created August 3, 2020 13:27
Example of deno post working
const addConditions = async ({ request, response}
: {request: any, response:any}) =>{
const body = await request.body();
if (!request.hasBody) {
response.status = 400
response.body = {
success: false,
message: 'KO'
}
@azaharafernandezguizan
azaharafernandezguizan / appDeno.ts
Created August 3, 2020 13:24
File app of Deno Server
import { Application } from 'https://deno.land/x/oak/mod.ts'
import { oakCors } from 'https://deno.land/x/cors/mod.ts';
import router from './routes.ts'
const HOST = '127.0.0.1'
const PORT = 7700
const app = new Application()
app.use(oakCors()); // Enable CORS for All RoutesS
@azaharafernandezguizan
azaharafernandezguizan / notWorkingDenoPost.ts
Created August 3, 2020 13:19
Post in Deno not working correctly
const addConditions = async (context: any) => {
const formData = await context.request.body() as IReceivedConditions;
formMealsMenu(formData);
context.response.body = { message: 'OK' };
context.response.status = 200;
}
@azaharafernandezguizan
azaharafernandezguizan / pageCalling.component.html
Created September 19, 2019 15:11
Call to anchor in Angular
<a [routerLink]="['/mipaginaconAnchor']" fragmente="tuId"> Ir a mi anchor </a>
@azaharafernandezguizan
azaharafernandezguizan / app-routing.module.ts
Created September 19, 2019 15:08
Routing module with anchor scrolling
@NgModule({
imports: [
RouterModule.forRoot(routes, {
onSameUrlNavigation: "ignore",
anchorScrolling:'enabled',
scrollPositionRestoration: 'enabled'
})
],
exports: [RouterModule]
})
@azaharafernandezguizan
azaharafernandezguizan / helloWorldGPIO.js
Last active September 9, 2019 10:10
Example of hello World on GPIO
var Gpio = require('onoff').Gpio;
var LED = new Gpio(18, 'out’);
var ledInterval = setInterval(sayHello, 300);
function sayHello () {
if (LED.readSync() === 0) {
LED.writeSync(1); //se enciende
} else {
LED.writeSync(0); //se apaga
@azaharafernandezguizan
azaharafernandezguizan / functor.ts
Created September 7, 2019 16:19
Example of functor Bosque Language
//Functor
var a = List[Int]@{...}
var b = a.map[Int]( fn(x)=>(x+2);
@azaharafernandezguizan
azaharafernandezguizan / bulkalgebraic.ts
Created September 7, 2019 16:16
Bulk algebraic data operations in Bosque Language
(@[7, 8]) <~ (0=5, 3=1); //@[5, 8, none, 1]
(@[7, 8] <+ (@[5]); // @[7, 8, 5]
@azaharafernandezguizan
azaharafernandezguizan / constructor.ts
Created September 7, 2019 16:11
Bosque Language object creation example
concept Bar{
...
field k: Bool;
}
var x=Baz@{f=1, g=2, k=true};
string? fullname = person switch
{
null => null,
(null, string lastname) => $"Señor/a {lastname}",
(string firstname, string lastname)=> $"{firstname} {lastname}"
}