This file contains hidden or 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
| ## Refactor docs | |
| This section is extremely important. A frequent source of frustration is deviations from this protocol. Take it very seriously and frequently refresh your memory on how to write planning documents. 99% of our time is spent iterating on planning documents, so it is extremely important that you do this correctly. | |
| - The primary way we plan things is through documents in the `refactor/` folder. | |
| - Move a `refactors/pending` doc to `refactors/past` once its work is implemented and tested, or we have decided that the work is not worth doing. | |
| - Each doc must, at all times that we are actively working on it, conform to several standards: | |
| - It should describe what we are building. Do not discuss how we came to a conclusion, or what we are not building. Do not narrate your thought process. Do not discuss what has already landed. | |
| - It should have enough information for a new agent, with no context, to completely implement the feature **without making any important decisions.** All decisions are mad |
This file contains hidden or 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 file contains hidden or 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
| // ==UserScript== | |
| // @name Following | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://twitter.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or 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
| type Props = { | |
| comment: CommentBody_comment$key, | |
| }; | |
| function CommentBody(props: Props) { | |
| const [data, refetch] = useRefetchableFragment<CommentBodyRefetchQuery, _>( | |
| graphql` | |
| fragment CommentBody_comment on Comment | |
| @refetchable(queryName: "CommentBodyRefetchQuery") { | |
| body(lang: $lang) { | |
| text |
This file contains hidden or 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 file shows an example of pagination using the new Relay Hooks | |
| * APIs. Please see old_container_based_api.react.jsx for an example of | |
| * how this might have looked using the previous, Container-based APIs. | |
| */ | |
| 'use strict'; | |
| import type {UserComponent_user$key} from 'UserComponent_user.graphql'; |
This file contains hidden or 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
| { | |
| match page { | |
| Page::Search(search_api_call) => ... | |
| } | |
| } |
This file contains hidden or 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
| { | |
| search_api_call_opt.as_ref().map(|ref mut search_api_call| { | |
| match &mut *search_api_call.borrow_mut() { | |
| PromiseState::Success(search_results) => { | |
| let search_results = search_results.clone(); | |
| render_search_results(search_results, |track_id| { | |
| page.go_to_detail_view(track_id); | |
| }) | |
| }, | |
| PromiseState::Pending => smd!(<p>Loading</p>), |
This file contains hidden or 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
| match & *unwrapped_promise.borrow() { | |
| smithy::types::PromiseState::Success(val) => { | |
| let val = val.clone(); | |
| smd!({ &mut val }) | |
| }, | |
| // ... | |
| } |
This file contains hidden or 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 React from 'react'; | |
| import { Form } from 'react-final-form'; | |
| export default ({ render, transform, ...rest })=> <Form | |
| {...rest} | |
| render={({ values, ...renderPropsRest }) => render({ values: transform(values), ...renderPropsRest })} | |
| />; | |
| // the function passed to transform is x => MyModelSubclass.getFromCache(x) |
This file contains hidden or 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
| // the following two are equivalent: | |
| // First | |
| let my_app = smd!( | |
| on_hash_change={on_hash_change_callback}; | |
| post_render={post_render_callback}; | |
| // comments can go anywhere | |
| { interpolated_item } | |
| <div | |
| ref={&mut my_ref} |
NewerOlder