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
[ | |
{ | |
"id":"KLAVIYO-TSHIRT1", | |
"title":"Classic Klaviyo T-Shirt 1", | |
"link":"https://klaviyogear.myshopify.com/collections/klaviyo-classics/products/short-sleeve-t-shirt-1", | |
"description":"Standard issue for all Klaviyos. This t-shirt has the Klaviyo logo on the front and mark diagram on the back.", | |
"price":10, | |
"image_link":"https://www.klaviyo.com/media/images/examples/products/klaviyo-tshirt-thumbnail.png", | |
"categories":["apparel","t-shirt","new-arrival","swag"], | |
"inventory_quantity":25, |
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
-- Add the following to your init.lua (or create it if it doesn't exist) | |
local Keyboard = require "keyboard" | |
Keyboard:init() |
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 { useState } from 'react'; | |
function useWhy(deps, id = null, logger = console.log) { | |
const [prevDeps, setPrevDeps] = useState(deps); | |
let changed = false; | |
deps.forEach((d, i) => { | |
if (d !== prevDeps[i]) { | |
changed = true; | |
logger(`Why ${id}: dep ${i} has changed from ${prevDeps[i]} to ${d}`); | |
} |
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 { compose } from 'redux'; | |
const ToUpper = (Component) => ({ text }) => <Component text={text.toUpper()} \> | |
const WithUnderscores = (Component) => ({ text }) => <Component text={text.split(' ').join('_')} /> | |
export default compose(ToUpper, WithUnderscores); | |
// use like this |
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
# What the fuck just happened to this file? | |
git reflog -p --since=yesterday -- $file | |
# I forgot my branch name. What am I working on? | |
git for-each-ref --sort=-committerdate refs/heads --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)'|column -ts'|' |
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 ReactDOM from 'react-dom'; | |
import Post from './Post'; | |
ReactDOM.render( | |
<Post postId="1" /> , | |
document.getElementById('root') | |
) |
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 PropTypes from 'prop-types'; | |
const route = 'https://jsonplaceholder.typicode.com/posts'; | |
class AsyncPostHoC extends React.Component{ | |
constructor(props){ | |
super(props); | |
this.state = { | |
isFetching: true, |
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 PropTypes from 'prop-types'; | |
import AsyncPostHoC from '...'; | |
const PostView = (props) => ( | |
<div> | |
<p>{props.title}</p> | |
<p>{props.body}</p> | |
</div> | |
); |
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 PropTypes from 'prop-types'; | |
const route = 'https://jsonplaceholder.typicode.com/posts'; | |
class AsyncPostHoC extends React.Component{ | |
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
const UppercaseHoC = (WrappedComponent) => class extends React.Component{ | |
render(){ | |
return( | |
<div style="text-transform: uppercase;"> | |
<WrappedComponent {...this.props} /> | |
</div> | |
) | |
} | |
} |
NewerOlder