Skip to content

Instantly share code, notes, and snippets.

@miguelerm
miguelerm / 001-respuestas-del-bootcamp.md
Last active March 14, 2022 21:31
Respuestas a las preguntas que surgieron (y quedaron pendientes de responder) durante de las sesiones del bootcamp de las primeras dos semanas.

En los videos se utiliza form.reset() pero eso no limpia los input[type=hidden]

Efectivamente hay un error en el video cuando construimos una aplicación con Vanilla JavaScript. En el ejemplo solamente utilizo form.reset() pero como bien lo resaltó Nery en la sesión en vivo, esto no limpia los <input type="hidden" />.

Para ver un ejemplo del error que mencionamos pueden ver el código del video aquí: https://github.com/laserants/bootcamp-js-2021/blob/6491906a0e0da48891c983b90d551b186300aae7/index.js#L78, y una posible solución es asignando un valor vacío a los campos ocultos despues de hacer el reset del form, por ejemplo: https://jsfiddle.net/miguelerm/54s8u9yf/

Básicamente la razon es que cuando a los input hidden les cambiamos el .value programáticamente, también modifican internamente su default value por lo que al hacer el reset asignan ese default value previamente modificado.

Recursos para manejo de autenticación

@miguelerm
miguelerm / invoke-pipeline.ps1
Last active February 1, 2023 14:57
Invoke an azure devops build pipeline via powershell script
param (
[Parameter(Mandatory = $true)][String]$pipelineName
# send parameters as a json serialized string
#[Parameter][String]$pipelineParameters
)
$auth = "Bearer $env:System_AccessToken"
$baseUri = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/";
$headers = @{Authorization = $auth };

Request 1 (Sin Response Cache ni Memory Cache):

Information: Request starting HTTP/1.1 GET http://localhost:62017/users  
Information: No cached response available for this request.
Debug: Looking up Users on cache
Debug: No cached entry available for Users.
Debug: Getting users from database
Information: The response has been cached.
Information: Request finished in 573.3304ms 200 application/json; charset=utf-8
@miguelerm
miguelerm / Program.cs
Created August 23, 2017 14:10
Explicit private Interface implementation
class Program
{
static void Main(string[] args)
{
var x = new Test();
var y = x as ITest;
y.Foo();
// "x" hasn't a Foo() method but "y" does.
}
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Text;
namespace LimeSurveyApiTest
{
class Program
{
private static readonly HttpClient client = new HttpClient();
public static class StringExtensions {
public static string Or(this string text, string alternativeText = "") {
return string.IsNullOrWhiteSpace(text) ? alternativeText : text;
}
}
/*
Ejemplo:
string texto = null;
@miguelerm
miguelerm / Program.cs
Created July 28, 2016 16:24
Convert word documents .doc to .pdf in batch.
// Install Nuget Package "NetOffice.Word"
using NetOffice.WordApi;
using System;
using System.IO;
namespace word2pdf
{
internal class Program
{
private static void Main(string[] args)
@miguelerm
miguelerm / log-wrapper.js
Last active February 3, 2016 15:18
A wrapper for console.log to listen the logged messages in a div with id "logger"
(function(window, console, document, undefined) {
var loggerId = 'logger';
var log = console.log.bind(console);
var queue = [];
var logger = getLogger();
console.log = customLog;
addEvent(window, 'load', onLoad);
function getLogger() {
// just a demo gulpfile for my projects
require('es6-promise').polyfill();
var del = require('del'),
gulp = require('gulp'),
iife = require('gulp-iife'),
sass = require('gulp-sass'),
gulpif = require('gulp-if'),
hash = require('gulp-hash-src'),
@miguelerm
miguelerm / developer-boxstarter.txt
Last active August 29, 2015 14:22
Script para instalación de un equipo nuevo de desarrollo.
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
cinst visualstudiocommunity2013 -y
cinst vs2013.powertools -y
cinst visualstudio2013-webessentials.vsix -y
cinst visualstudiocode -y
cinst fiddler4 -y
cinst linqpad -y
cinst git.install -y