• Nov 18, 2022 •AustinLeath
0 likes • 1 view
// Or const randomColor = () => `#${(~~(Math.random()*(1<<24))).toString(16)}`; console.log(randomColor);
• Jan 5, 2026 •C S
0 likes • 9 views
<div className="md:self-start sticky top-16 bg-background px-4 mt-1 sm:px-6 md:pt-4 lg:pl-8 lg:pr-4"> <ScrollArea className="whitespace-nowrap"> <div className="w-max flex md:flex-col gap-1 bg-transparent text-muted-foreground pb-2"> {menuData.map((section) => ( <Button key={section.title} onClick={() => handleScrollToSection(section.title)} variant="ghost" size="sm" className={cn( 'w-auto md:w-full hover:cursor-pointer relative md:justify-end', activeSection === section.title ? cn( 'text-foreground after:absolute after:bottom-[-2px] after:bottom-0 after:w-full after:h-[2px] after:bg-primary', 'md:after:right-[-2px] md:after:top-0 md:after:h-full md:after:w-[2px]', ) : '', )} > {section.title} </Button> ))} </div> <ScrollBar orientation="horizontal" /> </ScrollArea> </div>
0 likes • 2 views
//use this with canvas file finder function NewTab(testing) { window.open(testing, "_blank"); } for(test in results) { var testing = 'https://unt.instructure.com/files/' + test + '/download'; NewTab(testing); }
• Nov 19, 2022 •CodeCatch
// `arr` is an array const clone = arr => arr.slice(0); // Or const clone = arr => [...arr]; // Or const clone = arr => Array.from(arr); // Or const clone = arr => arr.map(x => x); // Or const clone = arr => JSON.parse(JSON.stringify(arr)); // Or const clone = arr => arr.concat([]);
0 likes • 3 views
function Welcome(props) { return <h1>Hello, {props.name}</h1>; } function App() { return ( <div> <Welcome name="Sara" /> <Welcome name="Cahal" /> <Welcome name="Edite" /> </div> ); } ReactDOM.render( <App />, document.getElementById('root') );
• Sep 13, 2023 •C S
0 likes • 11 views
/** * @param {number[]} nums * @return {number[]} */ var productExceptSelf = function(nums) { var output = []; var leftMult = 1; var rightMult = 1; for (var i=nums.length - 1; i >= 0; i--) { output[i] = rightMult; rightMult *= nums[i]; console.log({output: JSON.stringify(output), i}) } for (var j=0; j < nums.length; j++) { output[j] *= leftMult; leftMult *= nums[j]; console.log({output: JSON.stringify(output), j}) } return output; }; console.log(productExceptSelf([1, 2, 3, 4]))