Skip to content

Instantly share code, notes, and snippets.

View jamiejohnsonkc's full-sized avatar

Jamie Johnson jamiejohnsonkc

View GitHub Profile
@jamiejohnsonkc
jamiejohnsonkc / BackgroundImageContainer.jsx
Last active July 25, 2020 00:23
custom gatsby fluid image hook comp & implementation
/** @jsx jsx */
import { jsx } from "theme-ui"
import React from "react"
import { graphql, useStaticQuery } from "gatsby"
import styled from "@emotion/styled"
import BackgroundImage from "gatsby-background-image"
import useBackgroundImage from "./useBackgroundImage"
const BackgroundImageContainer = ({ className }) => {
const data = useBackgroundImage()
@jamiejohnsonkc
jamiejohnsonkc / setColorMode.js
Created July 7, 2020 23:10
Set colorMode React
const TestApp = () => {
const [colorMode, setColorMode] = useColorMode()
setColorMode("dark")
return (
<Box bg="primary" height="100px" width="100px">
<Text color="highlight">Test Text</Text>
</Box>
)
}
@jamiejohnsonkc
jamiejohnsonkc / simple react hooks hide function via styles
Created July 3, 2020 15:42
hide div using react hooks useState button
/** @jsx jsx */
import { jsx, Container } from "theme-ui"
import React, { useState } from "react"
function Demo2() {
const [isVisible, setIsVisible] = useState(true)
return (
<div style={{ display: isVisible ? "block" : "none" }}>
<p>This is the visibilityi test div</p>
To get the windows' dimensions :
var width = window.innerWidth;
var height = window.innerHeight;
To get the screen's dimensions :
var width = screen.width;
var height = screen.height;
const arr = ["The fastest way to", <br />, "build the fastest sites."]
/** @jsx jsx */
import { jsx } from "theme-ui"
import { StaticQuery, graphql } from "gatsby"
import React from "react"
import PropTypes from "prop-types"
const MegaMenuTest = (props) => {
return (
<StaticQuery
query={graphql`
import React, { Component } from "react"
import MyLink3 from "./MyLink3"
import { StaticQuery, graphql } from "gatsby"
const LinkList3 = () => {
return (
<StaticQuery
query={graphql`
query {
site {
@jamiejohnsonkc
jamiejohnsonkc / braces brackets and curlies.md
Last active June 18, 2020 15:54
javascript braces, brackets and curlies
@jamiejohnsonkc
jamiejohnsonkc / Fast_Delete.txt
Created June 6, 2020 21:26
Windows Fast Delete Commands
DEL /F/Q/S *.* > NUL
/F -- forces the deletion of read-only files.
/Q -- enables quiet mode. You are not ask if it is ok to delete files (if you don't use this, you are asked for any file in the folder).
/S -- runs the command on all files in any folder under the selected structure.
*.* -- delete all files.
> NUL -- disables console output. This improves the process further, shaving off about one quarter of the processing time off of the console command.
RMDIR /Q/S foldername