Skip to content

Instantly share code, notes, and snippets.

View ahmedmusawir's full-sized avatar
:electron:
Working from home

ahmedmusawir

:electron:
Working from home
View GitHub Profile
@ahmedmusawir
ahmedmusawir / newsletter.md
Created June 23, 2024 05:23
AI News Letter in Markdown

Hi All!

Here is your weekly dose of the Tech Newsletter, a list of what I find interesting and worth exploring.

Backstory

I was sipping my morning coffee and catching up on some real estate trends when it hit me – the Atlanta real estate market in 2024 is like a high-stakes game of Monopoly! With low inventory levels and elevated interest rates, it's shaping up to be quite the adventure. So, grab your coffee (or your beverage of choice) and let's dive in!

1/ Competitive Landscape

@ahmedmusawir
ahmedmusawir / GITHUB-REMOTE
Created November 16, 2021 07:24
REMOTE GITHUB COMMANDS
…or create a new repository on the command line
echo "# vidly-modern-react" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/ahmedmusawir/vidly-modern-react.git
git push -u origin main
@ahmedmusawir
ahmedmusawir / gist:0330d06a66c13f472a1cb120669d1904
Created May 15, 2020 03:52
BUDDYPRESS - WP_USER_QUERY - GET USERS W/ ROLES & BP CUSTOM FIELDS - AJAX FUNCTION
<?php
/**
* ATHLETE LOAD MORE WP FUNCITON FOR JQUERY AJAX
*/
add_action('wp_ajax_nopriv_athlete_dynamic_location_ajax_function', 'athlete_dynamic_location_ajax_function');
add_action('wp_ajax_athlete_dynamic_location_ajax_function', 'athlete_dynamic_location_ajax_function');
function athlete_dynamic_location_ajax_function() {
// LOAD MORE UNIV POSTS
@ahmedmusawir
ahmedmusawir / gist:3f140bdc6b7fcb0197e6c0dc99da8dc5
Last active October 30, 2018 06:22
DOCKER - JSON Server Command
docker run --name JSON-Users -d -p 8000:80 -v /home/moose/json-server/db.json:/data/db.json clue/json-server
@ahmedmusawir
ahmedmusawir / gist:b2bcd1478e46ed1557da1755a86b84da
Created October 30, 2018 05:08
DEVOPS – REACT – Fixing the “cannot GET /URL” error on refresh with React Router
Catch-all
If you already have a server you’re using, this is probably your best bet. The main idea here is that you redirect all of your server requests to /index.html. The outcome is similar to Hash History. Any request that is made to your server will respond with the index page (and then fetch any JS resources you need), React Router will then take over and load the appropriate view. The actual code for this varies on which type of you have. Here are some examples
Express
--------------
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'path/to/your/index.html'), function(err) {
if (err) {
res.status(500).send(err)
}
@ahmedmusawir
ahmedmusawir / gist:3fadfe423b45e11dbf01be9e41089ee3
Last active August 21, 2018 00:09
REACT - HTML + APP.JS + OTHER JS MODULES - HOW TO LOAD THEM IN AN HTML FILE W/ SCRIPT TAG & ES6 + BABLE
HTML FILE:
----------
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
@ahmedmusawir
ahmedmusawir / gist:6c6ccbb4e64721a5beb5e6a510ac4727
Last active August 20, 2018 04:05
REACT – ON ANY HTML PAGE WITHOUT CREATE REACT APP - W/ SCRIPT TAG FROM CDN
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<script crossorigin src="https://unpkg.com/[email protected]/babel.min.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
@ahmedmusawir
ahmedmusawir / gist:7885be074f6f2d5ab9c571d8b1ca703b
Created August 18, 2018 10:00
REACT - EVEN SHOWS STATE WITHOUT 'THIS' BINDING WITH ARROW FUNCTION
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export class Contact extends Component {
state = {
id: 1,
name: 'Bibo'
};
onShowClick = () => {
console.log(this.state);
@ahmedmusawir
ahmedmusawir / gist:f20537c600e015a50abacec52708716e
Created August 18, 2018 09:55
REACT - EVENTS WITH PASSING PARAMS
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export class Contact extends Component {
state = {};
onShowClick = (name, email, e) => {
console.log(this.state);
console.log(name, email, e.target);
};
@ahmedmusawir
ahmedmusawir / gist:53e7488b6c8dfdc859f6a6338e37ce89
Created June 29, 2018 04:08
JS - JQUERY - YOUTUBE API V3 - PULLING VIDEOS BY PLAYLIST
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
</head>
<body>
<style>
.row {
margin-left: 18%;
}