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
/** | |
* A console.assert which actually stop the exectution. | |
* default console.assert() is a plain display, such as console.log() or console.error(); | |
* It doesnt stop the execution like assert() is meant to do. This is a little code to | |
* "workaround this limitation" :) thanks @jensarp | |
* | |
* Usage: | |
* console.assert(foo === bar); // Will throw if not equal | |
* console.assert(foo === bar, 'Dude, foo does not equal bar'); // Will throw with custom error message | |
* |
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
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script> | |
<script type="text/javascript"> | |
// https://github.com/peers/peerjs | |
// go here to get your own key | |
var peerjsPeer = new Peer({key: 'xxxYOURKEYGOESHERExxxx'}); | |
peerjsPeer.on('open', function() { | |
console.log('My peerjsPeer ID is: ', peerjsPeer.id); | |
}); |
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 lang="en"> | |
<head> | |
<title>three.js canvas - geometry - cube</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> | |
<style type="text/css"> | |
body { | |
background-color: #f0f0f0; | |
margin: 0px; |
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
license: mit |
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
<script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script> | |
<script> | |
// Initialize Firebase | |
var config = { | |
// YOUR CONFIG goes here - https://firebase.google.com/docs/web/setup#add_firebase_to_your_app | |
}; | |
var firebaseApp = firebase.initializeApp(config); | |
var rootRef = firebase.database().ref(); | |
// Get a reference to the /users/ada node | |
var adaRef = firebase.database().ref("users/ada"); |
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
<html> | |
<script type="text/javascript"> | |
// https://developers.google.com/url-shortener/v1/getting_started | |
// | |
function load() { | |
// get your keys from here https://developers.google.com/url-shortener/v1/getting_started#APIKey | |
gapi.client.setApiKey('XXX-YOUR-KEY-GOES-HERE-XXXX'); |
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
var multilineString = (function(){ /* | |
this | |
is | |
a | |
multiline | |
string. | |
*/}).toString().split('\n').slice(1, -1).join('\n'); | |
console.log(multilineString); |
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
// You can generate the privatekey.pem and certificate.pem files using the following commands: | |
// | |
// openssl genrsa -out privatekey.pem 1024 | |
// openssl req -new -key privatekey.pem -out certrequest.csr | |
// openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem | |
const crypto = require('crypto'), | |
fs = require("fs"), | |
http = require("http"); |
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
<!-- Augmented Reality on the Web in 10 lines of html! https://github.com/jeromeetienne/ar.js --> | |
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script> | |
<script src="../build/aframe-ar.min.js"></script> | |
<body style='margin : 0px; overflow: hidden;'> | |
<a-scene embedded arjs='sourceType: webcam;'> | |
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box> | |
<a-marker-camera preset='hiro'></a-marker-camera> | |
</a-scene> | |
</body> |
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
self.addEventListener('message', function(event) { | |
console.log('in worker - received event', event) | |
self.postMessage('started') | |
}, false); |
NewerOlder