Skip to content

Instantly share code, notes, and snippets.

View mrlubos's full-sized avatar
🎯
Focusing

Lubos mrlubos

🎯
Focusing
View GitHub Profile
const inputs = [
[0, 1, 2, -10, 5],
[1, 2, -90, 7, 9, -10],
[-120, -50, 0, 1],
[-100, -20, -37],
[10, 2, 1, -10],
[1, 2, -1, 10, -100, 8],
[1, 2, -1, 10, -100, 8, 90],
[100, 400, -100, -200, 400, -100, -100],
[1, 2, -1, 0, 10, -100, 8],
@mrlubos
mrlubos / test.json
Last active September 10, 2018 14:17
{
"__manifest__": {
"description": "Hello!"
}
}
!function(e){function t(e,t){"use strict";function r(e){if("function"==typeof TextEncoder)return new TextEncoder("utf-8").encode(e);e=unescape(encodeURIComponent(e));for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function a(e){if("function"==typeof TextDecoder)return new TextDecoder("utf-8",{fatal:!0}).decode(e);var t=Math.ceil(e.length/8192);if(t<=1)try{return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}catch(e){throw new TypeError("The encoded data was not valid.")}for(var r="",n=0,_=0;_<t;_++){var s=Array.prototype.slice.call(e,8192*_+n,8192*(_+1)+n);if(0!=s.length){var c,h=s.length,o=0;do{var p=s[--h];p>=240?(o=4,c=!0):p>=224?(o=3,c=!0):p>=192?(o=2,c=!0):p<128&&(o=1,c=!0)}while(!c);for(var i=o-(s.length-h),y=0;y<i;y++)n--,s.pop();r+=a(s)}}return r}function n(e){e=f(null,e,"input");for(var t,r,a,n="",_=0;_<e.length;_++)a=87+(r=15&e[_])+(r-10>>8&-39)<<8|87+(t=e[_]>>>4)+(t-10>>8&-39),n+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);return n}funct
!function(e){function t(e,t){"use strict";var r,a="uint8array",n=t.ready.then(function(){if(0!==(r=t)._sodium_init())throw new Error("libsodium was not correctly initialized.");for(var a=["crypto_aead_chacha20poly1305_decrypt","crypto_aead_chacha20poly1305_decrypt_detached","crypto_aead_chacha20poly1305_encrypt","crypto_aead_chacha20poly1305_encrypt_detached","crypto_aead_chacha20poly1305_ietf_decrypt","crypto_aead_chacha20poly1305_ietf_decrypt_detached","crypto_aead_chacha20poly1305_ietf_encrypt","crypto_aead_chacha20poly1305_ietf_encrypt_detached","crypto_aead_chacha20poly1305_ietf_keygen","crypto_aead_chacha20poly1305_keygen","crypto_aead_xchacha20poly1305_ietf_decrypt","crypto_aead_xchacha20poly1305_ietf_decrypt_detached","crypto_aead_xchacha20poly1305_ietf_encrypt","crypto_aead_xchacha20poly1305_ietf_encrypt_detached","crypto_aead_xchacha20poly1305_ietf_keygen","crypto_auth","crypto_auth_hmacsha256","crypto_auth_hmacsha256_keygen","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmac
!function(A){function I(A){"use strict";var I;void 0===(I=A)&&(I={});var g=I;"object"!=typeof g.sodium&&("object"==typeof global?g=global:"object"==typeof window&&(g=window)),"object"==typeof g.sodium&&"number"==typeof g.sodium.totalMemory&&(I.TOTAL_MEMORY=g.sodium.totalMemory);var e=I;return I.ready=new Promise(function(A,I){(B=e).onAbort=I,B.onRuntimeInitialized=function(){try{B._crypto_secretbox_keybytes(),A()}catch(A){I(A)}};var g,B=void 0!==B?B:{},i={};for(g in B)B.hasOwnProperty(g)&&(i[g]=B[g]);B.arguments=[],B.thisProgram="./this.program",B.quit=function(A,I){throw I},B.preRun=[],B.postRun=[];var t,a,C=!1,r=!1,n=!1,o=!1;if(B.ENVIRONMENT)if("WEB"===B.ENVIRONMENT)C=!0;else if("WORKER"===B.ENVIRONMENT)r=!0;else if("NODE"===B.ENVIRONMENT)n=!0;else{if("SHELL"!==B.ENVIRONMENT)throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.");o=!0}else C="object"==typeof window,r="function"==typeof importScripts,n="object"==typeof process&&"function"==typeof require&&!C&&!r,o=
// Returns a random number to simulate our thinking.
function getThinkingTime () {
var base = 500,
deviation = 250;
return (Math.random() * deviation * 2) + (base - deviation);
}
// Starts the animation.
function startAnimation () {
// Points to the line in the array that is being animated.
var pointer = -1;
// Our copy of the line - we are free to do with it whatever we please.
var line = '';
// Holds the reference id to the active interval.
var interval;
// Starts the animation.
interval = setInterval(function () {
// Our copy of the line is empty.
// Loop through all of the lines and print them immediately.
for (var i = 0, length = strings.length; i < length; i++) {
app.println(strings[i]);
}
@mrlubos
mrlubos / tutorial-terminal-step-1.js
Last active July 15, 2016 03:08
We have created the strings that will be displayed in the animation.
// Get the node references for the elements required by Terminal.
var screen = document.getElementById('console__screen'),
title = document.getElementById('console__appname');
// Initialise Terminal with these settings.
var app = new Terminal({
elements: { screen, title },
device: 'tutorial',
user: 'student',
});