This document provides guidelines for maintaining high-quality Python code. These rules MUST be followed by all AI coding agents and contributors.
All code you write MUST be fully optimized.
"Fully optimized" includes:
At the end of this message, I will ask you to do something. Please follow the "Explore, Plan, Code, Test" workflow when you start.
First, use parallel subagents to find and read all files that may be useful for implementing the ticket, either as examples or as edit targets. The subagents should return relevant file paths, and any other info that may be useful.
Next, think hard and write up a detailed implementation plan. Don't forget to include tests, lookbook components, and documentation. Use your judgement as to what is necessary, given the standards of this repo.
If there are things you are not sure about, use parallel subagents to do some web research. They should only return useful information, no noise.
| import _ from "lodash" | |
| import React from "react" | |
| import moment from "moment" | |
| import { connect } from "react-redux" | |
| import API from "@Services/Api/profile" | |
| import { ApiManager } from "../../api/apiManager" | |
| import ParsedText from "react-native-parsed-text" | |
| import { NavigationEvents } from "react-navigation" | |
| import { DateToWordsFromNow } from "../../helpers/helper" | |
| import { ACTIVITY_NOTIFICATION } from "../../api/constants" |
| import _ from "lodash"; | |
| import React from 'react'; | |
| import moment from 'moment'; | |
| import { connect } from 'react-redux'; | |
| import API from '@Services/Api/profile'; | |
| import { ApiManager } from "../../api/apiManager"; | |
| import ParsedText from 'react-native-parsed-text'; | |
| import { NavigationEvents } from "react-navigation"; | |
| import { DateToWordsFromNow } from '../../helpers/helper'; | |
| import { ACTIVITY_NOTIFICATION } from "../../api/constants"; |
| function getCurrentPosition(options) { | |
| return new Promise(function(resolve, reject) { | |
| navigator.geolocation.getCurrentPosition(resolve, reject, options); | |
| }); | |
| } | |
| (async () => { | |
| const position = await getCurrentPosition().catch(err => console.log(err)); | |
| console.log(position); | |
| })(); |
| /** | |
| * Small debounce function. | |
| * | |
| * by Christian C. Salvadó <c@cms.gt> | |
| * MIT Style license, 2019 | |
| */ | |
| function debounce(fn, ms = 0) { | |
| let timer = 0 |
| export default function fetchWithTimeout(url, options, timeout = 3000) { | |
| const controller = new AbortController() | |
| const { signal } = controller | |
| setTimeout(() => controller.abort(), timeout) | |
| return fetch(url, { ...options, signal }) | |
| } |
| function capitalizeSentence(str) { | |
| return str.replace(/^\w|(\s\w)/g, function(match, index) { | |
| return match.toUpperCase() | |
| }); | |
| } | |
| capitalizeSentence('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); | |
| // "Lorem Ipsum Dolor Sit Amet, Consectetur Adipiscing Elit." |