Skip to content

Instantly share code, notes, and snippets.

curl --request PUT \
--url 'https://api.bigcommerce.com/stores/8mw570y811/v3/content/pages' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: xxxxxxxxxxxxxxxxx' \
--data '{"name":"Sandbox Page","is_visible":true,"parent_id":0,"sort_order":0,"type":"page","is_homepage":false,"is_customers_only":false,"id":0,"meta_title":"string","body":"<div>Hello World!</div>","feed":"string","link":"string","meta_keywords":"","meta_description":"string","search_keywords":"trousers,pockets,luxury","url":"/sandbox","channel_id":1}'
=== to automate this ===
for page in myhomepage ... ; do
import {ReactNode, useState} from "react";
export function Section({
children,
hideHeading,
className
}: { children?: ReactNode, className?: string, hideHeading?: boolean }) {
return <div style={{padding: 64}} className={className}>
{!hideHeading && <h1>My Hero</h1>}
{children}
This file has been truncated, but you can view the full file.
<div id="page"><!-- HTML_TAG_START --><div data-plasmic-project-id="sT7xEH9u4HQXUcstpAi7L4" data-plasmic-project-version="6.0.0" data-plasmic-component="ForCandidates" data-plasmic-project-token="" data-plasmic-component-data="{&quot;entryCompMetas&quot;:[{&quot;id&quot;:&quot;e5P5psP80_&quot;,&quot;displayName&quot;:&quot;For candidates&quot;,&quot;usedComponents&quot;:[&quot;WrZGaw5TTTf&quot;,&quot;EBt5g4hjXnx&quot;,&quot;z8Gc0CRV3W&quot;,&quot;YG-oOqp7g15&quot;],&quot;projectId&quot;:&quot;sT7xEH9u4HQXUcstpAi7L4&quot;,&quot;name&quot;:&quot;ForCandidates&quot;,&quot;renderFile&quot;:&quot;render__e5P5psP80_.js&quot;,&quot;skeletonFile&quot;:&quot;comp__e5P5psP80_.js&quot;,&quot;cssFile&quot;:&quot;css__e5P5psP80_.css&quot;,&quot;path&quot;:&quot;/pages/for-candidates&quot;,&quot;isPage&quot;:true,&quot;entry&quot;:&quot;render__e5P5psP80_.js&quot;,&quot;isCode&quot;:false,&quot;pageMetadata&quot;:{&quot;path&quot;:&quot;/pages/for-candidates&quot;,&quot;description&quot;:&quot;&quot;,&quot;title&quot;:&quo
@yang
yang / readme.md
Created April 20, 2022 05:28
Plasmic data fetching for codegen

You can manually install @plasmicapp/query and implement their extractPlasmicQueryData method.

It could be something like:

// data/data.tsx

export async function extractPlasmicQueryData(
  element: React.ReactElement
): Promise<Record<string, any>> {
@yang
yang / main.bash
Created March 7, 2022 20:48
Vercel instant rollbacks
Copy-pastable version of the code:
# Instant rollbacks on Vercel:
#
# vercel alias set PREVIOUS_DEPLOYMENT_DOMAIN PRODUCTION_DOMAIN
vercel alias set myapp-k8nj917m1-yaaang.vercel.app myapp.vercel.app
@yang
yang / gist:2e3dfe34e1e78040e28dfab8aadbc893
Created February 9, 2022 00:58
Import tokens into Plasmic Studio
/*
Customize the inputs in the `normalized` variable, then:
0. open your project in Plasmic Studio
1. open chrome devtools
2. use the top/left most button (the mouse selector) to inspect an element in the studio, such as the logo - this sets the focus on the correct iframe (rather than the outermost iframe)
3. switch to the console tab
4. paste the included snippet to populate the tokens
@yang
yang / gist:c9c3576d86a0c157a715e97ebb848373
Created January 29, 2022 07:43
Import Tailwind tokens
// Run this script in your directory containing tailwind.config.js, and follow the printed instructions to import them into your project.
const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require('tailwindcss/colors')
const config = require('./tailwind.config')
const extended = {
spacing: Object.assign({}, defaultTheme.spacing, config.theme.extend.spacing),
fontFamily: Object.assign({}, defaultTheme.fontFamily, config.theme.extend.fontFamily),
colors: Object.assign({}, defaultTheme.colors, config.theme.extend.colors),
@yang
yang / aoeu
Created November 22, 2021 20:15
Created from Remix Form!
aoeu
@yang
yang / index.html
Created July 15, 2018 06:58 — forked from lyudmil-mitev/index.html
CSS Transform Scale element to fit its parent
<html>
<head>
<title>CSS Transform Scale element to fit its parent</title>
<script src="scale2fit.js"></script>
<link rel="stylesheet" href="style.css"/>
<script>
(function(window) {
function main() {
const margin = 10;
requestAnimationFrame(function fitToParentOnResize() {
@yang
yang / code and results.txt
Last active June 12, 2018 00:25
Silly array benchmarks in diff languages
Ran on a 2015 MBP
HOTSPOT
public class Main {
public static void main(String[] args) {
int[] a = new int[500000000];
int[] b = new int[60000000];