This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let marcela = { | |
"nombre": "Marcela", | |
"edad": 25 } ; | |
console.log(marcela); | |
console.log("Edad de marcela " + marcela.edad); | |
console.log("El año que viene tendrá " + (marcela["edad"] + 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
fs.readdir("listados/", function(err, filenames) { | |
if (err) throw err; | |
filenames.forEach(function(filename) { | |
fs.readFile("listados/" + filename, 'utf-8', function(err, content) { | |
if (err) throw err; | |
console.log("Fichero: " + filename) | |
console.log(content) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'), | |
fs = require('fs'), | |
url = require('url'), | |
qs = require('querystring'); | |
const server = http.createServer((req, res) => { | |
switch (req.method) { | |
case 'POST': | |
var body = ''; | |
req.on('data', data => { body += data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const fs = require('fs'); | |
var personas; | |
fs.readFile("personas.json",'utf8', (err,datos) => { | |
if (err) throw err; | |
json = JSON.parse(datos); | |
console.log("Total personas:" + json.total); | |
personas = json.personas; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formidable = require('formidable'), fs = require('fs'), http = require('http') | |
http.createServer((req, resp ) => { | |
switch (req.method) { | |
case 'GET': pideFichero(req,resp); break; | |
case 'POST': procesaFichero(req,resp); break; | |
}}).listen(3000); | |
function procesaFichero(req,resp) { | |
var form = new formidable.IncomingForm(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><title>Formulario</title></head> | |
<body> | |
<h1>Procesa ficheros</h1> | |
<?php if ($_SERVER['REQUEST_METHOD'] == 'GET') : ?> | |
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" | |
method="POST" | |
enctype="multipart/form-data"> | |
<label>Nombre: | |
<input name="cliente"></label><br> | |
<label>Dame un fichero: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package examples | |
import cats._, data._ | |
import cats.implicits._ | |
object local { | |
type Env = Map[String,Int] | |
type MyState = List[Int] | |
type S[A] = EitherT[StateT[WriterT[Kleisli[List,Env,?],String,?],MyState,?], String, A] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import cats._, data._ | |
import cats.implicits._ | |
abstract class CheckerWriter { | |
type Config | |
type Err | |
type Log | |
implicit val logMonoid: Monoid[Log] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import cats._, data._ | |
import cats.implicits._ | |
abstract class Checker { | |
type Config | |
type Err | |
type Log | |
implicit val logMonoid: Monoid[Log] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package examples | |
import cats._, data._ | |
import cats.implicits._ | |
object writerTExample { | |
type Env = Int | |
type Err = String | |
type V[A] = Either[Err,A] | |
type ReaderV[A] = Kleisli[V,Env,A] |