View react-search-filter.js
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, |
View the-bottom.js
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 |
View component-with-accordion.js
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; |
View mongodb-queries.txt
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" | |
}) |
View react-form-handling.js
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 = {}; |
View gatsby-node.js
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 |
View gist:2fe9b3770786b9774b537b8b475f53ee
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
Verifying my Blockstack ID is secured with the address 19Qdh8zaHkHj6QxQdgf7eRnRjhhZkzaSBs https://explorer.blockstack.org/address/19Qdh8zaHkHj6QxQdgf7eRnRjhhZkzaSBs |
View pseudo-reader.js
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
// How to read a pseudo class in JS | |
window.getComputedStyle( | |
document.querySelector('.element'), ':before' | |
); |
View scroll-checker.js
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 |
NewerOlder