This file contains hidden or 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
// Photoshop script to replace a Smart Object within a PSD using "Place Embedded" with specified image and saves result as a JPG. Preserves transformations. | |
// 2025. Use at your own risk | |
// Can be run in an automated fashion on Mac via AppleScript: | |
// osascript -e "tell application \"Adobe Photoshop 2025\" to activate do javascript of file \"replace_smartobject_psd_placeembedded.jsx\"" | |
#target photoshop | |
var mockupFilePath = "~/mockup.psd"; | |
var designFilePath = "~/design.png"; |
This file contains hidden or 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
/* | |
1. Use a more-intuitive box-sizing model. | |
*/ | |
*, | |
*::before, | |
*::after { | |
box-sizing: border-box; | |
} | |
/* |
This file contains hidden or 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
function onFontLoaded(fontFamily) { | |
const font = `1rem ${fontFamily}`; | |
return new Promise((resolve, reject) => { | |
const isFontAvailable = document.fonts.check(font); | |
if (isFontAvailable) { | |
resolve(); | |
} else { | |
document.fonts.ready | |
.then(() => { | |
if (document.fonts.check(font)) { |
This file contains hidden or 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
// This function will return a promise that runs the passed in promise, but | |
// for at least the time specified. This is helpful for UI interactions | |
// that should look like they're processing something. | |
// | |
// By design, if an error occurs, it'll still wait for the time specified | |
// before throwing. | |
async function runPromiseForMinimumTime(promise, minimumTime = 500) { | |
let error; | |
const [, result] = await Promise.all([ | |
new Promise(r => setTimeout(r, minimumTime)), |
This file contains hidden or 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
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + |
This file contains hidden or 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 isFunction from "lodash/isFunction"; | |
class Lifecycles extends React.Component { | |
async componentDidMount() { | |
if (this.props.didMount) { | |
await this.props.didMount({ props: this.props }); | |
} | |
} |
This file contains hidden or 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 isFunction from "lodash/isFunction"; | |
class State extends React.Component { | |
constructor(...args) { | |
super(...args); | |
this.boundSetState = this.setState.bind(this); | |
this.state = isFunction(this.props.initialState) |
This file contains hidden or 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
/* | |
<ModalContainer> | |
<ModalBackdrop /> | |
<ModalFrames> | |
<ModalFrame> | |
<ModalGutter /> | |
<ModalWindow> | |
<ModalHeader /> | |
<ModalBody /> | |
<ModalFooter /> |
This file contains hidden or 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 upperCaseFirstLetter = string => { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
}; | |
const lowerCaseFirstLetter = string => { | |
return string.charAt(0).toLowerCase() + string.slice(1); | |
}; | |
const camelToDashCase = string => { | |
return lowerCaseFirstLetter(string).replace( |
This file contains hidden or 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
function getAllSearchParamsFromSearch(search) { | |
let massagedSearch = search; | |
if (massagedSearch.charAt(0) === "?") { | |
massagedSearch = massagedSearch.substring(1); | |
} | |
// Filter out the search parameters that have been passed in | |
return massagedSearch.split("&").map(part => { | |
return part.split("="); |
NewerOlder