Skip to content

Instantly share code, notes, and snippets.

@ff8c00
ff8c00 / Hard.html
Created August 12, 2018 17:54
Reddit Daily Programmer 364 Hard
<html>
<head>
<script>
function Square(x, y) {
this.x = x;
this.y = y;
this.move = function(row, column) {
return new Square(this.x + column, this.y + row);
};
this.check = function(width, height) {
@ff8c00
ff8c00 / Intermediate.html
Created May 14, 2018 17:35
Reddit Daily Programmer 360 Intermediate
<html>
<head>
<script src="GreatCircle.js">
</script>
<script>
function open(url, callback) {
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@ff8c00
ff8c00 / Easy.html
Last active May 12, 2018 18:07
Reddit Daily Programmer 359 Easy
<html>
<head>
<script>
function print(a) {
var b;
b = a.map(function(v) {
return v ? "1" : "0";
});
document.write(b.join(""));
}
@ff8c00
ff8c00 / Easy.html
Created April 28, 2018 20:33
Reddit Daily Programmer 358 Easy
<html>
<head>
<script>
function decipher(input) {
var output, map, number, i, j, k;
output = [];
map = [
" _ | ||_|",
" | |",
@ff8c00
ff8c00 / Intermediate.html
Created April 4, 2018 14:14
Reddit Daily Programmer 355 Intermediate
<html>
<head>
<script>
function cook(ingredients, quantity, available) {
var required = ingredients.map(function(v) {
return this * v;
}, quantity);
return required.map(function(v, i) {
return this[i] - v;
}, available);
@ff8c00
ff8c00 / Easy.html
Created April 4, 2018 10:38
Reddit Daily Programmer 355 Easy
<html>
<head>
<script>
function encode(keyword, message) {
var alphabet, table, i, result, j, k;
alphabet = "abcdefghijklmnopqrstuvwxyz".split("");
table = [];
for (i = 0; i < alphabet.length; i++) {
table.push(alphabet.slice());
@ff8c00
ff8c00 / Intermediate.html
Created March 18, 2018 10:13
Reddit Daily Programmer 343 Intermediate
<html>
<head>
<script>
var mozart = [
[ 96, 32, 69, 40, 148, 104, 152, 119, 98, 3, 54],
[ 22, 6, 95, 17, 74, 157, 60, 84, 142, 87, 130],
[141, 128, 158, 113, 163, 27, 171, 114, 42, 165, 10],
[ 41, 63, 13, 85, 45, 167, 53, 50, 156, 61, 103],
[105, 146, 153, 161, 80, 154, 99, 140, 75, 135, 28],
[122, 46, 55, 2, 97, 68, 133, 86, 129, 47, 37],
@ff8c00
ff8c00 / background.js
Last active April 4, 2018 10:38
Chrome web server (Reddit Daily Programmer 322 Hard)
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create("window.html");
});
@ff8c00
ff8c00 / Intermediate.html
Last active March 17, 2018 10:56
Reddit Daily Programmer 354 Intermediate
<html>
<head>
<script>
var map = [];
map[1] = 1;
function multiply(n) {
var A, i, j, k;
A = [];
@ff8c00
ff8c00 / Easy.html
Last active March 12, 2018 21:28
Reddit Daily Programmer 354 Easy
<html>
<head>
<script>
function run() {
var a = 0;
var b = 0;
var c = 0;
var n = 0;
a = 1234567891011;