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 getSelectedLayerType() { | |
/** | |
* Gets the type of a given layer | |
* | |
* @param {Layer} layer Layer to check | |
* @return {string} Layer type | |
*/ | |
function getLayerType(layer) { | |
switch (layer.matchName) { | |
case "ADBE Vector Layer": |
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
export function readable<R, E = unknown>( | |
promise: Promise<R>, | |
onSuccess?: (result: R) => void, | |
onError?: (error: E) => void) | |
{ | |
let status = 'pending'; | |
let result: R; | |
const suspender = promise.then(result => { | |
status = 'fulfilled'; | |
onSuccess && onSuccess(result); |
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 watchExternal(paths: string[]): Plugin { | |
console.log('Watching external paths: ', paths); | |
return { | |
name: 'watch-external', | |
configureServer(server) { | |
// Server is the Vite dev server instance | |
// Start watching external files | |
paths.forEach(path => { | |
if (!fs.existsSync(path)) { | |
console.warn(redBright(`${path}`)) |
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 useArrayCompare<T>(value: T[]) { | |
const ref = useRef<T[]>(value); | |
if (value.length !== ref.current.length ||value.sort().join(',') !== ref.current.join(',')) { | |
ref.current = value; | |
} | |
return ref.current; | |
} |
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 { execSync } = require('child_process'); | |
// Replace the array with the usernames of the developers whose commits you want to fetch | |
const developers = ['developer1', 'developer2', 'developer3']; | |
function getCommitsByDevelopers() { | |
const commits = []; | |
for (const developer of developers) { | |
const gitCommand = `git log --author="${developer}" --pretty=format:"%h"`; | |
const commitHashes = execSync(gitCommand).toString().trim().split('\n'); |
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
GOOS=windows GOARCH=amd64 go build |
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
// jonschlinkert/is-object | |
type IsObjectObject<T> = T extends | |
| AnyArray | |
| AnyFunction | |
| boolean | |
| null | |
| number | |
| string | |
| symbol | |
| undefined |
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
#!/bin/bash | |
ancestor_branch=${1:-"origin/develop-sdk"} | |
# Find the latest common ancestor commit | |
joint_commit=$(git merge-base HEAD $ancestor_branch) | |
echo $joint_commit | |
# Get the list of commit hashes from current HEAD to the joint commit | |
commit_hashes=$(git rev-list --ancestry-path ${joint_commit}..HEAD) |
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 { useState, useEffect } from 'react'; | |
function useDebouncedValue<T>(value: T, delay: number): T { | |
const [debouncedValue, setDebouncedValue] = useState(value); | |
useEffect(() => { | |
const handler = setTimeout(() => { | |
setDebouncedValue(value); | |
}, delay); |
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
class extends Generator { | |
writing() { | |
// enable force overwrite | |
this.conflicter.force = true; | |
this.fs.copyTpl( | |
this.templatePath('_package.json'), | |
this.destinationPath('package.json'), | |
{ appname: 'your_appname' } | |
); |