Skip to content

Instantly share code, notes, and snippets.

View danieldunderfelt's full-sized avatar

Daniel Dunderfelt danieldunderfelt

View GitHub Profile
@danieldunderfelt
danieldunderfelt / initializeFormState.js
Created May 26, 2018 05:03
Updated initial state with getDerivedStateFromProps with React 16.4 compatibility.
import * as reduce from 'lodash/reduce'
import * as get from 'lodash/get'
import * as isMatch from 'lodash/isMatch'
export default (nextProps, state) => {
if (nextProps.mutationLoading) {
return null
}
const prevProps = get(state, '_prevProps', false)
@danieldunderfelt
danieldunderfelt / MdxContent.js
Created July 10, 2019 05:49
MDX in React-native
// Use your MDX content with this component.
import React from 'react'
import MDX from '@mdx-js/runtime'
import components from '../utils/markdown/markdown'
// Renders a cimple loading spinner as a test
import Loading from './Loading'
const mdxComponents = {
@danieldunderfelt
danieldunderfelt / CursorTools.json
Created January 31, 2025 11:16 — forked from ScriptedAlchemy/CursorTools.json
Reverse Engineering cursor prompts
{
"tools": [
{
"type": "function",
"function": {
"name": "codebase_search",
"description": "Find snippets of code from the codebase most relevant to the search query.\nThis is a semantic search tool, so the query should ask for something semantically matching what is needed.\nIf it makes sense to only search in particular directories, please specify them in the target_directories field.\nUnless there is a clear reason to use your own search query, please just reuse the user's exact query with their wording.\nTheir exact wording/phrasing can often be helpful for the semantic search query. Keeping the same exact question format can also be helpful.",
"parameters": {
"type": "object",
"properties": {
@danieldunderfelt
danieldunderfelt / sst.config.partial.ts
Last active May 11, 2025 15:15
SST config with circular dependencies
async run() {
const vpc = new sst.aws.Vpc('AppVPC')
const database = new sst.aws.Aurora('AppDB', {
engine: 'postgres',
scaling: {
min: '1 ACU',
max: '10 ACU',
},
dataApi: true,