Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Hello world

Cory Simmons corysimmons

👋
Hello world
View GitHub Profile
View buffer.js
// monster image to pic.png
const fs = require('fs')
// trimmed the `data:image/png;base64,` off the front of it
const x = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAQoAAAFmCAMAAACiIyTaAAABv1BMVEUAAAB5S0dJSkpISkpLTU3pSzzoTD3oSzzoTD3kSjvoTD1GRUbeSDpFREVCQULpSzzoTD3c3d3gSTrg4uDm5uZFRETbRznoTD3oTD1JR0iXlYXaRzncRzhBQUDnSjtNS0zUzsdnZmVLSEpMSEoyNjPm5eSZmYfm6ekzNTOloI42ODbm6Oiioo/h4eEzODbm5+eop5SiopCiopDl396hloaDg3ToTD3m5uZMS03///9RTlAAAADy8vIgICA2NzY4OzYPM0fa29qgoI7/zMnj4+PW19VGRkbqPi7v7/D6+vr09fXyTj4rKSvhSTo/Pj/oSDnlMyLsNCI0MTP0///tTT7ZRjizOi+6PDDmLRyenZ7oKRfExMT/TzvobGEVFBWGhYUAGjLW8/ToXVADLUZ8e33/2tfRRTdWVFTFQDT1u7aSkZIADib+5eFwcHHW+/z70tDwkIesPTPW6+teXV2xsbG7u7vY4+Lre3DMzM2qp6jilIxsPT7lg3kdO07m/f4AJjuwsJzftK/fpZ7woJjoVUZBWGj1zMdTaXfcvrrzq6Tby8f+8u8wSlYZNDaQRUKfr7d9j5lpf4vx5ePMsLF/o64s+PNlAAAANnRSTlMAC1IoljoZWm2yloPRGWiJfdjEEk037Esq7Pn24EKjpiX+z7rJNNWB5pGxZ1m2mZY/gXOlr43C+dBMAAAmkklEQVR42uzay86bMBAF4MnCV1kCeQFIRn6M8xZe+v1fpVECdtPSy5822Bi+JcujmfEApl3IIRhBFyIJ3Em6UMTDSKfHsOB0dhILQ2fX4+4aF0tVXC3yJJB4OrcJV1msIhJN52avslh
View auto-grid.css
.auto-grid {
grid-template-columns: repeat( auto-fit, minmax(250px, 1fr) );
}
@corysimmons
corysimmons / props-in-styled-components.js
Created Jun 15, 2020
Cleaner props in styled-components from Sara Vieira's Twitter thread https://twitter.com/Saeris/status/1262441528078688256
View props-in-styled-components.js
import styled, { css } from 'styled-components'
const Styles = styled.div(({ someProp }) => css`
font-size: ${someProp ? '10px' : '20px'};
`)
View useKeys.ts
import { useState, useLayoutEffect } from 'react'
const specialKeys = [
`Shift`,
`CapsLock`,
`Meta`,
`Control`,
`Alt`,
`Tab`,
`Backspace`,
View fakeup_privacy_policy.md

FakeUP doesn't track or use any information about you for anything.

@corysimmons
corysimmons / vscode_shortcuts.md
Created Nov 1, 2019 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode
View vscode_shortcuts.md

VSCode Shortcuts

List of helpful shortcuts for faster coding

Official List of all commands

Open/View

@corysimmons
corysimmons / Modal.css.js
Last active Jun 8, 2019
Scrollable react-modal's within Next.js
View Modal.css.js
import { css } from '@emotion/core'
import styled from '@emotion/styled'
import ReactModal from 'react-modal'
ReactModal.setAppElement('#__next')
ReactModal.defaultStyles = {}
export const globalStyles = css`
.ReactModal__Html--open,
.ReactModal__Body--open {
@corysimmons
corysimmons / eslint-sort-imports.json
Last active Jun 8, 2019
With ESLint, eslint-plugin-autofix, and eslint-plugin-import you can replace VSCode's buggy `organizeImports` setting with ESLint and organize imports for an entire project in one CLI `$ yarn lint --fix`
View eslint-sort-imports.json
{
"scripts": {
"lint": "eslint '{,!(node_modules)/**/}*.js'"
},
"eslintConfig": {
"plugins": [
"autofix",
"import"
],
"rules": {
View gist:fd860f43b24e9bdb55005c997fc30eca
const ContentVideo = ({ videoId, on }) => {
const player = useRef();
useEffect(() => {
player.current = new YTPlayer('#' + videoId);
player.current.load(videoId);
}, []);
useEffect(() => {
if (!on) {
@corysimmons
corysimmons / wp_users_plus_wp_usermeta.sql
Created Feb 11, 2019
Combine wp_users and wp_usermeta into a single table with columns (for wp_users) and a big JSON object (for all the wp_usermeta junk).
View wp_users_plus_wp_usermeta.sql
SELECT
u.id,
u.user_login,
concat('{ ' , group_concat(concat(m.meta_key, ': ''', m.meta_value, '''')) , ' }' ) AS meta
FROM
wp_users AS u
JOIN
wp_usermeta AS m
WHERE
u.id = m.user_id