- state this in a sentence or two
- state this as a user-facing outcome
- constraints solution needs to abide by (budget, timelinem, space, memory, etc)
export const wrapBenchmark = ( | |
fn: (...args: any[]) => any, | |
label?: string | |
): ((...args: any[]) => any) => { | |
return (...args) => { | |
const start = Date.now() | |
const result = fn.apply(null, args) | |
const end = Date.now() | |
console.info(`📈 BENCHMARK${label ? ` ${label}` : ''} ${end - start}ms`) | |
return result |
function GetGreetingForSubject({subject}) { | |
const [isLoading, setIsLoading] = React.useState(false) | |
const [error, setError] = React.useState(null) | |
const [greeting, setGreeting] = React.useState(null) | |
React.useEffect(() => { | |
async function fetchGreeting() { | |
try { | |
const response = await window.fetch('https://example.com/api/greeting') | |
const data = await response.json() | |
setGreeting(data.greeting) |
const activeColorBorderStyle = "2px solid rgb(255, 0, 0)"; | |
const inactiveColorBorderStyle = "0"; | |
const legend = document.querySelector("ul.legend"); | |
const svg = document.querySelector("svg.js-calendar-graph-svg"); | |
let colorChangeEnabled = false; | |
let selectedColorBox = null; | |
let selectedColor = null; |
from problem import ArithmeticProblem | |
def arithmetic_arranger(problems, show_answer=False): | |
try: | |
if len(problems) > 5: | |
raise ValueError("Too many problems.") | |
def convert_problem(s): | |
return str(ArithmeticProblem(s, show_answer)).splitlines() |
<?php | |
// Approach 1 | |
$lb = "\n"; | |
for ($i = 1; $i <= 100; $i++) | |
{ | |
if ($i % 15 === 0) { | |
echo "FizzBuzz $lb"; |
/** | |
* Definition for a singly-linked list. | |
* class ListNode { | |
* public $val = 0; | |
* public $next = null; | |
* function __construct($val = 0, $next = null) { | |
* $this->val = $val; | |
* $this->next = $next; | |
* } | |
* } |
/** | |
* Definition for a singly-linked list. | |
* class ListNode { | |
* public $val = 0; | |
* public $next = null; | |
* function __construct($val = 0, $next = null) { | |
* $this->val = $val; | |
* $this->next = $next; | |
* } | |
* } |
/** | |
* Definition for a singly-linked list. | |
* class ListNode { | |
* public $val = 0; | |
* public $next = null; | |
* function __construct($val = 0, $next = null) { | |
* $this->val = $val; | |
* $this->next = $next; | |
* } | |
* } |