Skip to content

Instantly share code, notes, and snippets.

import { ToastContainer, toast, Zoom, cssTransition } from 'react-toastify';
const validEmailRegex = RegExp(
/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i
);
const bounce = cssTransition({
enter: "animate__animated animate__rubberBand",
exit: "animate__animated animate__zoomOut"
@KravMaguy
KravMaguy / mapfunctions.js
Created March 10, 2021 02:14
draw a polyline around a search area
var w = window.innerWidth;
var input = document.getElementById("pac-input");
if (w < 600) {
input.style.width = "300px";
}
input.style.borderRadius = "2px";
input.style.height = "50px";
var chicago = { lat: 41.85, lng: -87.65 };
function openSearch() {
@KravMaguy
KravMaguy / mapfunctions_2.js
Created March 27, 2021 17:41
google map not rendering properly on all_buildings.php page
const state={
isPolygon:false,
}
var w = window.innerWidth;
var input = document.getElementById("pac-input");
if (w < 600) {
input.style.width = "300px";
}
input.style.borderRadius = "2px";
input.style.height = "50px";
@KravMaguy
KravMaguy / all_buildings.php
Created March 27, 2021 17:46
all_buildings.php
<?php
require_once 'inc/header.php'; //include the header file
require_once 'scripts/pdocon.php'; //include the db connector
require_once 'scripts/functions.php'; //include the functions file
?>
<?
if (isset($_GET['success']) && $_GET['success'] == 1) {
echo "<div class='alert alert-success alert-dismissable fade show custom-alert' role='alert'>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>&times;</span>
@KravMaguy
KravMaguy / functions.php
Created May 6, 2021 21:29
Trying to send form data to acculynx server from the client side
<?php
include 'secrets.php';
add_action( 'wp_head', 'cf7_form_send_to_acculynx' );
function cf7_form_send_to_acculynx() {
?>
<script>
document.addEventListener("wpcf7mailsent", function (event) {
const details = event.detail.inputs;
const name = details[0].value;
const email = details[1].value;
@KravMaguy
KravMaguy / functions.php
Created May 6, 2021 21:35
php only post
<?php
include 'secrets.php';
add_action( 'wpcf7_mail_sent', 'cf7_form_send_to_acculynx' );
function cf7_form_send_to_acculynx($contact_form) {
$submission=WPCF7_Submission::get_instance();
if($submission){
$posted_data=$submission->get_posted_data();
$name=$posted_data['your-name'];
$email=$posted_data['your-email'];
@KravMaguy
KravMaguy / srs
Last active May 12, 2021 20:23
gtag wordpress contact form 7 track form submission
<!DOCTYPE html>
<html lang="en-US">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-115893469-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-115893469-1');
@KravMaguy
KravMaguy / gist:0ac5bc4b528ffe8296ecc66a0a446517
Created June 29, 2021 20:09
max recurring element two ways
const globalArr = [
1, 3, 0, -10, -10, 4, 4, 4, 4, 4, 4, 4, 0, -10, 4, -10, 0, -3,
];
const loggResult = (el, count) =>
console.log(
`the most frequent value is ${el} occuring ${count} times in the array`
);
const findMaxRecurring = (array) => {
@KravMaguy
KravMaguy / issues.tsx
Created July 12, 2021 20:32
issues component
import { Card, Badge, Button } from "react-bootstrap";
export interface IProps {
issues: {
title : string,
id : string,
repository_url : string,
html_url : string,
user:{
html_url : string,
import { useState, useEffect } from "react";
import axios from "axios";
import IssuesComponent from "./IssuesComponent";
import { IState, Issue } from "./Types";
import CardComponent from "./CardComponent";
import FilterForm from "./FilterForm";
import PaginationComponent from "./PaginationComponent";
import { Form } from "react-bootstrap";
const BaseUrl = "https://api.github.com/repos/";