made with esnextbin
Created
June 12, 2016 23:21
-
-
Save amilajack/5ad0bb0ebd68e2a1db4e0a405c86d9bc to your computer and use it in GitHub Desktop.
esnextbin sketch
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> | |
<body> | |
<p>Image to use:</p> | |
<img id="scream" width="220" height="277" src="http://www.w3schools.com/tags/img_the_scream.jpg" alt="The Scream"> | |
<p>Canvas:</p> | |
<canvas id="myCanvas" width="240" height="297" style="border:1px solid #d3d3d3;"> | |
Your browser does not support the HTML5 canvas tag. | |
</canvas> | |
<script> | |
window.onload = function() { | |
var c = document.getElementById("myCanvas"); | |
var ctx = c.getContext("2d"); | |
var img = document.getElementById("scream"); | |
ctx.drawImage(img, 10, 10); | |
} | |
</script> | |
<p><strong>Note:</strong> The canvas tag is not supported in Internet | |
Explorer 8 and earlier versions.</p> | |
</body> | |
</html> |
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 { expect } from 'chai' | |
function superCheckDupe(array) { | |
for (let i = 0; i < array.length; i++) { | |
if (array.indexOf(array[i]) !== i) return false | |
} | |
return true | |
} | |
const pass = [1, 4, 5, 2, 6, 8] | |
const fail = [1, 4, 5, 2, 6, 8, 8] | |
expect(superCheckDupe(pass)).to.equal(true) | |
expect(superCheckDupe(fail)).to.equal(false) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"chai": "3.5.0" | |
} | |
} |
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
'use strict'; | |
var _chai = require('chai'); | |
function superCheckDupe(array) { | |
for (var i = 0; i < array.length; i++) { | |
if (array.indexOf(array[i]) !== i) return false; | |
} | |
return true; | |
} | |
var pass = [1, 4, 5, 2, 6, 8]; | |
var fail = [1, 4, 5, 2, 6, 8, 8]; | |
(0, _chai.expect)(superCheckDupe(pass)).to.equal(true); | |
(0, _chai.expect)(superCheckDupe(fail)).to.equal(false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment