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 foo = async function() { | |
const timeAtBeginning = new Date().getTime(); | |
const vals = []; | |
for(let a of [1, 2, 3]) { | |
vals.push( | |
await new Promise( r => setTimeout(r, 1000, a * 2) ) | |
); | |
} | |
const timeAtEnd = new Date().getTime() - timeAtBeginning; |
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 CaesarCipher = (function() { | |
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(""); | |
const encrypt = function encrypt(msg, key) { | |
if ( !typeof msg == 'string' || !Number.isInteger(key) ) { | |
return false; | |
} | |
return Array.from(msg) |
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
/* Converts a decimal number to its hexadecimal equivalent. Pre-ES6 version | |
(or just convert it yourself, using https://babeljs.io): https://goo.gl/7xpMdf | |
Or, you could just use "Number.prototype.toString" */ | |
const integer = 220; | |
const decimalToBase16Equivalent = function decimalToBase16Equivalent(num) { | |
if(num >= 10) { | |
num = { | |
'10': 'A', |
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> | |
<meta charset="UTF-8"> | |
<title>Simple Snake Game</title> | |
<!-- Basic styling, centering of the canvas. --> | |
<style> | |
canvas { | |
display: block; |
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
<?php | |
namespace Ortify; | |
use Ratchet\ConnectionInterface; | |
use Ratchet\Wamp\WampServerInterface; | |
include_once "/../../../components/db_connection.php"; | |
class Pusher implements WampServerInterface { | |
/** |
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> | |
<!-- | |
These are JQuery and Materialize, however they wouldn't work since they are local directoreis, you will have to include your own. | |
<script src="dependencies/jquery/jquery.min.js"></script> | |
<script src="dependencies/jquery/jquery-ui.min.js" type="text/javascript"></script> |