This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// Choose either "stable" for receiving highly polished, | |
// or "canary" for less polished but more frequent updates | |
updateChannel: 'canary', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This router depends on the history package: | |
yarn add history | |
Simple router for switching between routes. Based on | |
[hashrouter.js](https://gist.github.com/danieldunderfelt/4d016333a947764c1a5687d26d48ca27) | |
Suitable for MobX/Redux architecture and especially | |
handy for tabs, which is the reason why it exists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple router for switching between hash stings. | |
* Suitable for MobX/Redux architecture and especially | |
* handy for tabs, which is the reason why it exists. | |
const state = { currentTab: 'lions' } | |
function activateTab(tabName) { | |
// Dispatch state change | |
state.currentTab = tabName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am danieldunderfelt on github. | |
* I am ddunderfelt (https://keybase.io/ddunderfelt) on keybase. | |
* I have a public key whose fingerprint is 5548 BD67 2A79 92E1 530F 1A25 46CF C630 C47E 05E9 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* PROBLEM: | |
* In next.js, each route points to a distinct top-level component. | |
* Since there is no higher-level components in next.js, how to have | |
* a store that persists between route changes is not immediately | |
* obvious. One solution is this: a higher-order component that you | |
* wrap each of your top-level route components with. | |
* | |
* This is borrowed from next.js' Redux example from here: | |
* https://github.com/zeit/next.js/wiki/Redux-example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* App creator */ | |
import { extendObservable } from 'mobx' | |
import AppStore from '../app/AppStore' | |
export default (initialState = false) => { | |
const stores = { | |
App: AppStore | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function safe($array) | |
{ | |
return function($key, $fallback) use ($array) | |
{ | |
if(!is_array($key)) | |
{ | |
return isset($array[$key]) ? $array[$key] : $fallback; | |
} | |
if(!isset($array[$key[0]])) |
NewerOlder