Skip to content

Instantly share code, notes, and snippets.

View AlexMercedCoder's full-sized avatar
🎯
Focusing

Alex Merced AlexMercedCoder

🎯
Focusing
View GitHub Profile
@AlexMercedCoder
AlexMercedCoder / memo.js
Created April 17, 2021 03:53
example of memoization in javascript
////////////////////////////////////
// Example of Memoization by Alex Merced of AlexMercedCoder.com
///////////////////////////////////
const addNums = (x,y) => x + y
const createMemo = (thefunc) => {
const cache = {}
@AlexMercedCoder
AlexMercedCoder / nestedjs.js
Created April 17, 2021 13:52
Nest Data Structures in Javascript
///////////////////////////////
// Array of Objects
//////////////////////////////
console.log("------------------------------------")
const dogs = [
{name: "Spot", age: 6},
{name: "Fluffy", age: 6},
{name: "Clifford", age: 6},
{name: "Lassi", age: 6},
]
@AlexMercedCoder
AlexMercedCoder / pattern.js
Created April 18, 2021 14:03
Pattern Matching Javascript
// Example String
const stringy = "| ohtml | odiv | Hello World | cdiv | chtml |";
// Function that matches a string against a pattern
const matcher = (str) => {
// declare some variables
let tag;
let split;

webpack.config

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = (env) => {
  const { production } = env ? env : { production: false };
@AlexMercedCoder
AlexMercedCoder / reactwebpack.md
Created April 19, 2021 14:06
Intro to Webpack for React Settings

webpack.config.json

const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

const config = {
    mode: process.env.NODE_ENV ? process.env.NODE_ENV : "development",
    module: {
@AlexMercedCoder
AlexMercedCoder / python_curr.md
Last active May 22, 2021 14:09
Self-Guided: From 0 to Flask Curriculum

Goal

This is a 6 day self-paced curriculum to learn the python language and the basics of the Flask Web Framework.

Day 1 - Starting Python

@AlexMercedCoder
AlexMercedCoder / dom.js
Created August 10, 2021 23:23
jQuery and Plain Vanilla DOM side by side
///////////////////////////////////////
// Selecting an element by element, class, id
///////////////////////////////////////
// PLAIN VANILLA JS
const h1 = document.querySelector("h1");
const byClass = document.querySelector(".class");
const byId = document.querySelector("#id");
// jQuery
const $h1 = $("h1");
const $byClass = $(".class");
@AlexMercedCoder
AlexMercedCoder / expressmongo.js
Created August 13, 2021 15:25
Ways of Writing Express/MongoDB routes (Callback, Async/Await, .then)
///////////////////////////////////////
// Writing the Index Route all three ways
// (Callback,.then, async/await)
///////////////////////////////////////
// callback
app.get("/dogs", (req, res) => {
Dog.find({}, (err, data) =>
err ? res.status(400).json(err) : res.json(data)
);
@AlexMercedCoder
AlexMercedCoder / resume.md
Last active October 4, 2021 23:22
Alex Merced Resume

Alex Merced

Developer, Educator, Problem Solver, Tech Evangelist

alex@alexmerced.dev - 860 995 1048 - AlexMercedCoder.com

Mission: To leverage my ability to educate about and promote technology with passion and charisma into a role as a Developer Advocate where I can empower developers to use cutting edge technologies to develop the ground breaking apps of tomorrow.

Skills

Skill Detail
@AlexMercedCoder
AlexMercedCoder / readme.md
Last active October 20, 2021 02:41
Express Templating Cheatsheet

Intro

Express can be used several different templating engines, most engines will assume by default that all your templates are in a "views" folder. To render a template you'll use the render function in side the response object in your express routes.

res.render("template.extension", {data: [1,2,3,4]})

Render will search for a template file called "template.extension" in the views folder and pass the object to the template engine to use when rendering the template.