Skip to content

Instantly share code, notes, and snippets.

View mikedemarais's full-sized avatar
💭
my life is dope and i do dope shit

Michael Demarais mikedemarais

💭
my life is dope and i do dope shit
View GitHub Profile
@intergalacticspacehighway
intergalacticspacehighway / CollapsibleText.tsx
Last active July 10, 2024 19:50
Collapsible text using reanimated
import { useEffect, useRef } from "react";
import { View } from "react-native";
import Animated, {
useAnimatedStyle,
useSharedValue,
} from "react-native-reanimated";
// Example
export default function App() {
import { type PublicClient, type WalletClient } from "@wagmi/core";
import { providers } from "ethers";
import { type HttpTransport } from "viem";
import { useEffect, useState } from "react";
import type { JsonRpcProvider, JsonRpcSigner } from "@ethersproject/providers";
import { usePublicClient, useWalletClient } from "wagmi";
export function publicClientToProvider(publicClient: PublicClient) {
const { chain, transport } = publicClient;
@markdalgleish
markdalgleish / thoughts.md
Created August 3, 2023 00:04
Some thoughts on T-shirt sizing for spacing scales in design systems

Someone asked me about the spacing scale in Braid and I thought I'd share my thoughts here. For reference this is what they were referring to: https://github.com/seek-oss/braid-design-system/blob/ecdd7f3060cab2a6675cde7dd45bcd510caa268b/packages/braid-design-system/src/lib/themes/baseTokens/apac.ts#L166-L175

I could maybe have turned this into a blog post, but I'm just dropping my rough thoughts here instead.

In practice, the T-shirt size scale felt like indirection because our designers didn't think in those terms so it actually got in the way of developers and designers communicating.

The names also weren't really semantic in the sense that we couldn't confidently change them later without breaking a lot of layouts.

It also made it difficult to name new values to the scale, e.g. if we needed to add a value between "small" and "medium", what would we call it? I've seen things like "xmedium" in other systems before which shows how awkward this can get.

@fiveoutofnine
fiveoutofnine / 1_example-glyphs.txt
Last active June 17, 2024 20:43
Quick snippets/tutorial on how to condense a font by selecting a subset of characters. First, create a `.txt` file with the characters (as unicode chars) you want included.
U+0039
U+003A
U+002F
U+0023
U+0050
U+0075
U+007A
U+006C
U+0065
U+0041
@sbauch
sbauch / useDelegatedAccount.ts
Created January 18, 2023 16:20
Example hook for using delegate cash with wagmi hooks.
import { useAccount, useContractRead } from 'wagmi';
import { abi, address as delegateCashAddress } from '~abis/delegateCash';
import { env } from '~env/client.mjs';
export function useDelegatedAccount() {
const { address, isConnected, ...account } = useAccount();
const txConfig = {
address: delegateCashAddress,
@barthap
barthap / react-native+0.68.2.patch
Created July 18, 2022 16:39
RN 0.68 patch to have iOS 15 detents in <Modal> component
diff --git a/node_modules/react-native/Libraries/Modal/Modal.js b/node_modules/react-native/Libraries/Modal/Modal.js
index 9140a56..1a26c51 100644
--- a/node_modules/react-native/Libraries/Modal/Modal.js
+++ b/node_modules/react-native/Libraries/Modal/Modal.js
@@ -246,6 +246,7 @@ class Modal extends React.Component<Props> {
return (
<RCTModalHostView
+ modalSheetSize={this.props.modalSheetSize}
animationType={animationType}
@mikedemarais
mikedemarais / npm-download-count-scriptable.js
Created May 28, 2022 06:20
Scriptable script for widget that displays NPM download count for a given package
let package = '@rainbow-me/rainbowkit';
const param = args.widgetParameter;
if (param != null && param.length > 0) {
package = param;
}
const upperFirst = s => s && s[0].toUpperCase() + s.slice(1);
async function getDownloads(timePeriod) {
let url = `https://api.npmjs.org/downloads/point/last-${timePeriod}/${package}`;
@moodysalem
moodysalem / example.sol
Last active April 1, 2022 22:05
Transient Storage Example
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
/// @notice The canonical ERC20 interface
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(
@z0r0z
z0r0z / MultiSigNFT.sol
Created December 28, 2021 17:32
EIP-712-signed multi-signature contract with NFT ids for signers.
// SPDX-License-Identifier: GPL-3.0-or-later
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/tokens/ERC721.sol";
error NoGovParity();
error NoExecParity();
error SigBounds();
@z0r0z
z0r0z / SocialGraphNFT.sol
Created December 27, 2021 22:07
NFT that is a social graph where ID holders can add new ID holders through overridden transfers
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/tokens/ERC721.sol";
/// @notice NFT that is a social graph where ID holders can add new ID holders.
contract SocialGraphNFT is ERC721("Social Graph NFT", "SGNFT") {
string public baseURI;
uint256 public tokenIdCounter;