This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
############################## | |
########### Search ########### | |
############################## | |
Included are steps to help make this script easier for other to follow | |
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10 | |
I also updated this work to include XSS and SQL injection projection | |
[list_searcheable_acf list all the custom fields we want to include in our search query] | |
@return [array] [list of custom fields] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SCROLL CHECKER | |
* | |
* Description: | |
* This function scans all incoming clicks. | |
* This allows users to easily click outside an active offcanvas menu. | |
* | |
* | |
* Usage: | |
* This function analyzes the kinds of clicks that could come a page and an offcanvas menu. | |
* It's checking for a hamburger menu, a menu closing mechanism, links in a menu and links on a page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.cluemediator.com/search-filter-for-multiple-object-in-reactjs | |
import React, { useState } from 'react'; | |
function App() { | |
const dataList = [ | |
{ | |
"id": 1, | |
"name": "cerulean", | |
"year": 2000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pageURL = window.location.href; | |
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1); | |
console.log(lastURLSegment); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3- Take listItemsArray and loop through it w/ regex | |
for (var i = 0; i < listItemsArray.length; i++) { | |
// 4- Use regex to break each list item into five pieces | |
listItemsTemp[i] = listItemsArray[i].match(/(<li\b(?:>\s+(?:id="([^"]*)"|class="([^"]*)")|[^\s>]+|\s+)*>)|((<\w+\b>)|(<a\shref=".*">)|(.+?(?=<))|(<\/\w+\b)>)/g); | |
// 5- Setup listItemsRearranged[i] with an array of listItemsTemp.length | |
listItemsRearranged[i] = new Array(listItemsTemp.length); | |
// 6- Take listItemsTemp and reassign positions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Link from 'gatsby-link' | |
import styled from 'styled-components' | |
// Styles, w/ styled-component syntax | |
const NavContainer = styled.nav` | |
background-color: ${props => props.theme.lightGray}; | |
font-size: 14px; | |
max-width: ${props => props.theme.xs}; | |
overflow: auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mongo DB commands | |
db.restaurants.insert({ | |
"name": "Haikan", | |
"address" : { | |
"street" : "805 V Street NW", | |
"zipcode" : 20001 | |
}, | |
"cuisine": "Ramen" | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
/* Handling a Form */ | |
class Form extends React.Component { | |
// Set up a state object that's just empty | |
// You'll see why it's empty in handleChange | |
constructor(props) { | |
super(props); | |
this.state = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Give Node access to path | |
const path = require('path') | |
const fs = require('fs') | |
// Setup parser for taking apart the HTML Description hack stuff from Shopify | |
const DomParser = require('dom-parser') | |
const shopifyDescParser = new DomParser() | |
exports.createPages = async ({ graphql, actions }) => { | |
const { createPage } = actions |
NewerOlder