Skip to content

Instantly share code, notes, and snippets.

@netgfx
netgfx / Main.tsx
Created April 12, 2023 10:12
Framer + Supabase realtime (receiver)
import { ComponentType, useRef, useState } from "react"
import { useEffect } from "react"
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0"
import { randomColor } from "https://framer.com/m/framer/utils.js@^0.9.0"
import * as SupabaseJs from "https://jspm.dev/@supabase/supabase-js@rc"
import _ from "lodash"
// Learn more: https://www.framer.com/docs/guides/overrides/
export const useStore = createStore({
background: "#0099FF",
@EllyLoel
EllyLoel / reset.css
Last active January 24, 2025 09:14
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@netgfx
netgfx / MasonryLayout.tsx
Last active February 25, 2024 00:13
Framer Masonry (pinterest layout)
import { useEffect, useState } from "react"
import { motion, Variants } from "framer-motion"
import { addPropertyControls, ControlType } from "framer"
import React from "react"
// Welcome to Code in Framer
// Get Started: https://www.framer.com/docs/guides/
export function useMediaQuery(query) {
const [matches, setMatches] = useState(false)
@hyrious
hyrious / esbuild-plugin-styled-components.js
Created October 20, 2021 03:09
esbuild plugin styled-components
import babel from '@babel/core'
import styled from 'babel-plugin-styled-components'
import fs from 'node:fs'
export default {
name: "styled-components",
setup({ onLoad }) {
const root = process.cwd();
onLoad({ filter: /\.[tj]sx$/ }, async (args) => {
let code = await fs.promises.readFile(args.path, "utf8");
@HansKre
HansKre / WithBouncingAnimation.tsx
Last active June 20, 2024 16:36
framer-motion
import { ReactNode } from 'react';
import { motion } from 'framer-motion';
type Props = {
children: ReactNode;
delay?: number;
};
export default function WithBouncingAnimation({ children, delay }: Props) {
return (
@ericclemmons
ericclemmons / [[...slugs]].tsx
Created July 12, 2021 16:14
Non-FB-scale MDX with shared layout/nav
import Layout from "@/components/Layout";
import { getContentPaths } from "@/utils/getContentPaths";
import { getPageFromSlug } from "@/utils/getPageFromSlug";
import { GetStaticProps } from "next";
import dynamic from "next/dynamic";
import { renderToStaticMarkup } from "react-dom/server";
export default function ContentPage({ __html, frontmatter, pages, slug }) {
const Content = dynamic(() => import(`../content/${slug}/index.mdx`), {
loading() {
@sonnylazuardi
sonnylazuardi / code.ts
Created June 11, 2021 04:27
Resizable Figma Plugin Window
figma.showUI(__html__,{width: 250, height: 250});
// restore previous size
figma.clientStorage.getAsync('size').then(size => {
if(size) figma.ui.resize(size.w,size.h);
}).catch(err=>{});
figma.ui.onmessage = msg => {
switch (msg.type) {
case "resize":
figma.ui.resize(msg.size.w,msg.size.h);
figma.clientStorage.setAsync('size', msg.size).catch(err=>{});// save size
@FahimF
FahimF / SimpleCollectionView.swift
Last active December 13, 2022 00:52
A UICollectionView implementation of UIListContentConfiguration
import UIKit
class SimpleCollectionView: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
private var collectionView: UICollectionView!
private var cellRegistration: UICollectionView.CellRegistration<UICollectionViewListCell, Book>!
override func viewDidLoad() {
super.viewDidLoad()
// View title
title = "Books - Collection"
@slorber
slorber / react-navigation-tree.jsx
Last active August 13, 2022 19:17
react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
@igorcferreira
igorcferreira / DynamicNavigationDestinationLink.swift
Last active September 2, 2019 11:27
Small Playground content, showcasing the use of DynamicNavigationDestinationLink to display content from remote source on SwiftUI