Skip to content

Instantly share code, notes, and snippets.

Cory Simmons corysimmons

Block or report user

Report or block corysimmons

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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

View reeeact.js
const ThisFuckingSucks = props => {
const {children} = props
return (
<SomeOtherComponent {...props}>{children}</SomeOtherComponent>
)
}
const HowCanIDoSomethingLikeThis = (props, {children}) => (
<SomeOtherComponent {...props}>{children}</SomeOtherComponent>
@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
@corysimmons
corysimmons / selenium_chromedriver_nightwatch.md
Last active Jul 17, 2018
How to get Selenium + chromedriver + Nightwatch working.
View selenium_chromedriver_nightwatch.md

https://npm.im/selenium-standalone doesn't work with recent versions of JDK and will cause Nightwatch to explode.

selenium-standalone

export JAVA_HOME=/usr/libexec/java_home -v 1.8
View react-native-viewport-units.js
import { Dimensions, PixelRatio } from 'react-native'
const { width, height } = Dimensions.get(`window`)
export const vw = size => size * width / PixelRatio.getPixelSizeForLayoutSize(100) / PixelRatio.get()
export const vh = size => size * height / PixelRatio.getPixelSizeForLayoutSize(100) / PixelRatio.get()
export const vmin = Math.min(vw, vh)
export const vmax = Math.max(vw, vh)
@corysimmons
corysimmons / DimensionWatcher.js
Created Feb 16, 2018
Wrap things in this. Get map dimension state as props on children. ⚠️Doesn't re-render anything because God is a lie.
View DimensionWatcher.js
import React, { Fragment } from 'react'
import { Dimensions } from 'react-native'
import { connect } from 'react-redux'
class DimensionWatcher extends React.Component {
handleDimensionsChange = dimensions => this.props.dispatch({
type: `DIMENSIONS_CHANGED`,
payload: dimensions,
})
@corysimmons
corysimmons / Dimensions.js
Created Feb 16, 2018
WIP React component to get dimensions of screen.
View Dimensions.js
import React, { Fragment } from 'react'
import { Dimensions } from 'react-native'
export default class ScreenMediaQuery extends React.Component {
state = {
dimensions: {
width: Dimensions.get(`window`).width,
height: Dimensions.get(`window`).height,
mode: Dimensions.get(`window`).width > Dimensions.get(`window`).height ? `landscape` : `portrait`,
},
You can’t perform that action at this time.