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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// problem explanation at https://gist.github.com/outoftime/fc52bd13465d4aaaf1d9 | |
collatz_cache = {1 : 0} | |
def find_maximum_collatz_chain(maximum_value): | |
maximum_length = 0 | |
largest_value = 1 | |
for num in range(2, maximum_value): | |
chain_length = get_collatz_chain_length(num) | |
if chain_length > maximum_length: |
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
// Much code based on http://scotch.io/tutorials/javascript/build-a-restful-api-using-node-and-express-4 | |
var express = require('express'); // call express | |
var app = express(); // define our app using express | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.use(bodyParser.json()); | |
app.use(function (req, res, next) { |
NewerOlder