Skip to content

Instantly share code, notes, and snippets.

View prevwong's full-sized avatar
πŸ€’
be right back

Prev Wong prevwong

πŸ€’
be right back
View GitHub Profile
@prevwong
prevwong / craft-cypress.js
Last active February 13, 2021 16:26
Craft-Cypress Commands
class DummyDataTransfer {
data = {};
dropEffect = 'move';
effectAllowed = 'all';
files = [];
items = [];
types = [];
@prevwong
prevwong / πŸ“Š Weekly development breakdown
Last active August 6, 2024 09:26
Weekly Coding Breakdown
Zig 21 hrs 43 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘ 72.0%
TypeScript 6 hrs 6 mins β–ˆβ–ˆβ–ˆβ–ˆβ–Žβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 20.3%
Java 2 hrs 1 min β–ˆβ–β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 6.7%
Other 9 mins β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.5%
JSON 4 mins β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.2%
@prevwong
prevwong / example-grid-craft.js
Created January 4, 2020 18:54
A simple Grid layout system with Craft.js
// Get total `width` of all children
const getAccumulatedChildrenWidth = (helper, parentId) => {
return helper(self.id).decendants().map(id => helper(id).get())
.reduce((a, b) => a.data.props.width + b.data.props.width, 0);
}
const Grid = () => {
return (
<div>
{children}