Skip to content

Instantly share code, notes, and snippets.

@kenhoff
kenhoff / fragments-6.jsx
Created June 12, 2018 21:35
fragments-6
class App extends React.Component {
render() {
return (
<>
<p>I would</p>
<p>really like</p>
<p>to render</p>
<p>an array</p>
</>
);
@kenhoff
kenhoff / fragments-5.jsx
Created June 12, 2018 21:34
fragments-5
class App extends React.Component {
render() {
return (
<React.Fragment>
<p>I would</p>
<p>really like</p>
<p>to render</p>
<p>an array</p>
</React.Fragment>
);
@kenhoff
kenhoff / fragments-4.jsx
Created June 12, 2018 21:33
fragments-4
class App extends React.Component {
render() {
return [
<p>I would</p>,
<p>really like</p>,
<p>to render</p>,
<p>an array</p>
];
}
}
@kenhoff
kenhoff / fragments-3.jsx
Created June 12, 2018 21:32
fragments-3
class App extends React.Component {
render() {
return (
<div>
<p>I would</p>
<p>really like</p>
<p>to render</p>
<p>an array</p>
</div>
);
@kenhoff
kenhoff / fragments-2.txt
Created June 12, 2018 21:31
fragments-2
Failed to compile.
./src/App.js
Syntax error: Adjacent JSX elements must be wrapped in an enclosing tag (6:8)
4 | return (<p>I would
5 | </p>
6 | <p>
| ^
7 | really like
@kenhoff
kenhoff / fragments-1.jsx
Created June 12, 2018 21:29
fragments-1
class App extends React.Component {
render() {
return (
<p>I would</p>
<p>really like</p>
<p>to render</p>
<p>an array</p>
);
}
}
@kenhoff
kenhoff / waveform-mask.html
Created December 7, 2017 15:40
waveform-mask.html
<!-- this SVG is the "clipping mask" - the waveform bars -->
<svg height="0" width="0">
<defs>
<clipPath id="waveform-mask"></clipPath>
</defs>
</svg>
@kenhoff
kenhoff / getting-waveform-data.js
Created December 7, 2017 15:39
getting-waveform-data.js
let audioCtx = new(window.AudioContext || window.webkitAudioContext)();
axios({url: "/car-talk.mp3", responseType: "arraybuffer"})
.then(response => {
var audioData = response.data;
audioCtx.decodeAudioData(audioData, buffer => {
decodedAudioData = buffer.getChannelData(0);
console.log(decodedAudioData);
});
@kenhoff
kenhoff / float-array.txt
Created December 7, 2017 15:38
float-array.txt
Float32Array(143669376)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.000030517578125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …]
@kenhoff
kenhoff / final-bucket-values.txt
Created December 7, 2017 15:37
final-bucket-values.txt
0.28 0.20 0.20 0.21 0.26 0.18 0.18 0.18 0.18 0.17
0.18 0.19 0.18 0.18 0.18 0.18 0.24 0.23 0.25 0.23
0.28 0.19 0.29 0.27 0.20 0.22 0.22 0.21 0.18 0.22
0.25 0.24 0.17 0.20 0.34 0.26 0.27 0.23 0.19 0.14
0.26 0.22 0.22 0.24 0.25 0.24 0.21 0.18 0.25 0.25
0.21 0.28 0.23 0.34 0.23 0.17 0.23 0.24 0.23 0.27
0.22 0.24 0.25 0.24 0.23 0.14 0.33 0.28 0.17 0.23
0.27 0.30 0.24 0.23 0.17 0.20 0.27 0.22 0.22 0.21
0.25 0.21 0.24 0.24 0.26 0.21 0.21 0.16 0.23 0.22
0.28 0.22 0.28 0.24 0.29 0.25 0.21 0.27 0.20 0.20