Skip to content

Instantly share code, notes, and snippets.

@amilajack
Created June 12, 2016 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amilajack/5ad0bb0ebd68e2a1db4e0a405c86d9bc to your computer and use it in GitHub Desktop.
Save amilajack/5ad0bb0ebd68e2a1db4e0a405c86d9bc to your computer and use it in GitHub Desktop.
esnextbin sketch
<!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>
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)
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"chai": "3.5.0"
}
}
'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