Skip to content

Instantly share code, notes, and snippets.

View carloswm85's full-sized avatar
🎯
Compiling...

Carlos W. Mercado carloswm85

🎯
Compiling...
View GitHub Profile
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>First Page</title>
<script>
function greetUser(){
let name = prompt("Please, user, enter your name: ");
let greeting = "Hello, " + name + "hope you are having a wonderful day!";
alert(greeting);
@carloswm85
carloswm85 / example.py
Created July 3, 2021 20:49
Example for StackOverflow comment.
# Post: https://stackoverflow.com/a/60060509/7389293 for VSCode
""" This is a long comment """
# TODO: Add checkbox, just for printing a sample, just text, of the structure, for websites.
""" This is the same long comment, but automatically trimmed and
continued around column 79 """
# TODO: Add checkbox, just for printing a sample, just text, of the structure,
# for websites.
@carloswm85
carloswm85 / array_iteration_thoughts.md
Last active October 3, 2021 02:47 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

carloswm85: For personal use.

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return

@import 'https://fonts.googleapis.com/css?family=Open+Sans';
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: 'Open Sans', sans-serif;
line-height: 1.75em;

This code works correctly in Postman, but it does not work in my app, nor using this same structure in the code nor the getJson() custom function we learned to use in the class.

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-MBX-APIKEY", "W4wBtjQxbUWdDiRak0kC6mbIi28zYCmghxIa6vUTUWljNilQA766nHH9RN6I1tpf");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
@carloswm85
carloswm85 / cors-nightmare.md
Last active December 15, 2021 03:17
Trying to implement bypass CORS Chrome browser policy in a Vanilla JS Binance API small project. Using node-fetch.

I've had a really bad time looking for a solution for this. The only thing that I was able to make for for getting the listening key, was adding this extension to my browser https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf/related?hl=es

I came across some other solutions, like some extra dependencies (axios, for example) or running a proxy server (light-server,or lite-server, or some nodejs-proxy-server), but I was not able to make those work in time really.

For what I was able to see, this CORS policy is a big issue for developers. https://www.youtube.com/results?search_query=cors+javascript+fetch

With that extension I was able to get some information about the Request and Response given to/from the server using DevTools from Chrome. Do you think it may be possible to get some information from those headers I can use in my raw code? So I can get rid of that extension. I tried to use some of the key-value pairs I considered to be part of the solution, eve

Severity Code Description Project File Line Suppression State
Error CS0426 The type name 'Collections' does not exist in the type 'System' MiningGuide.Data C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Data\Model\Contacto.cs 13 Active
Error CS0138 A 'using namespace' directive can only be applied to namespaces; 'System' is a type not a namespace. Consider a 'using static' directive instead MiningGuide.Data C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Data\Model\Expediente.cs 12 Active
Error CS0426 The type name 'Collections' does not exist in the type 'System' MiningGuide.Data C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Data\Model\Expediente.cs 13 Active
Error CS0426 The type name 'Diagnostics' does not exist in the type 'System' MiningGuide.Data C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Data\Model\Expediente.cs 17 Active
Error CS0246 The type or namespace name 'Nullable<>' could not be found (are you missing a using directive or an as