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
<artifacts_info> | |
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. | |
# Good artifacts are... | |
- Substantial content (>15 lines) | |
- Content that the user is likely to modify, iterate on, or take ownership of | |
- Self-contained, complex content that can be understood on its own, without context from the conversation | |
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) | |
- Content likely to be referenced or reused multiple times |
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
const measureScrollbar = () => { | |
const scrollDiv = document.createElement('div'); | |
let scrollbarWidth = 0; | |
scrollDiv.classList.add('scrollbar-measure'); | |
document.body.appendChild(scrollDiv); | |
scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; | |
document.body.removeChild(scrollDiv); | |
return scrollbarWidth; |
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 { forEach } from 'lodash'; | |
// vs. | |
import forEach from 'lodash/forEach'; | |
// First import bundles the whole lodash library while | |
// the second import only the core and the forEach! | |
// Big difference in the final file size! |
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 '../base/_sizes.pcss'; | |
@import '../base/_color.pcss'; | |
body.debug { | |
&::after { | |
position: fixed; | |
content: ''; | |
width: auto; | |
max-width: 100%; |
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
// https://github.com/seaneking/postcss-responsive-type | |
h3 { | |
margin-bottom: calc(28px + 34 * ((100vw - 375px) / 1650)); | |
font-size: responsive 18px 26px; | |
font-range: 375px 2025px; | |
text-transform: uppercase; | |
line-height: responsive 22px 28px; | |
line-height-range: 375px 2025px; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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 solution(A) { | |
var p, idx, | |
leftSum = 0, | |
rightSum = 0, | |
totalSum = A.reduce(function(pv, cv) { return pv + cv; }, 0), | |
lastMin, | |
currentMin, | |
N = A.length; | |
if (N === 2) { |
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 solution(A) { | |
var missing_int = 0, | |
i = 0; | |
for (i; i < A.length; i++) { | |
missing_int ^= A[i]; | |
} | |
return missing_int; | |
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 solution(A, K) { | |
var result = [], | |
i = 0, | |
j = 0; | |
if (A.length === 0) { | |
return A; | |
} | |
if (K > A.length) { |
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 solution(N) { | |
return parseInt(N, 10). | |
toString(2). | |
replace(/^0+|0+$/g, ''). | |
split('1'). | |
reduce(function (a, b) { | |
return a.length > b.length ? a : b; | |
}).length | |
} |