This file contains hidden or 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
Y = function(f) { | |
var f_xx = function(x) { | |
return f(function(v) { return x(x)(v); }); | |
}; | |
return f_xx(f_xx); | |
}; | |
var factorial = Y(function(self) { | |
return function(n) { | |
return n == 0 ? 1 : n*self(n - 1); | |
}; |
This file contains hidden or 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 http = require('http'); | |
process.on("uncaughtException", function(){vote();}); | |
var count = 0; | |
var vote = function() { | |
var fetched = false; | |
var poster = []; | |
var data = { | |
"recaptcha_challenge_field": "03AHJ_Vuu9MDRN0efmOk0w1eyknSbmFJMf2kM3fMCyoR4aX319zjel6Q4YKFIBs9wqXa0zqy8kx8E6DG1dTGRiGAhF3Pe67Zdlnp8mGkTYEPFQTYg9pBYswsnC693eG4oVv9L_4aSUFjbMmaThaETlDMq-S-TlK0Pca7jCsLLivus6ZDFijVxGTSg", |
This file contains hidden or 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
// To Access Once Running: `telnet localhost 8124` | |
var net = require('net'); | |
var users = []; | |
var red = '\033[31m'; // command line colors | |
var reset = '\033[0m'; | |
var server = net.createServer(function(c) { | |
// handle new connection | |
c.on('end', function() { | |
console.log("end"); |
This file contains hidden or 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 http = require('http'), | |
fs = require('fs'); | |
var fetchShow = function(code) { | |
http.get({ | |
host: "www.j-archive.com", | |
port: 80, | |
path: "/showgame.php?game_id="+code | |
}, function(response) { | |
var buffer = []; |
This file contains hidden or 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 app = require('route'); | |
app.get({ | |
path: /\/api\//, | |
cb: function(req, res) { | |
res.end(JSON.stringify({success: true})); | |
} | |
}, { | |
path: /\/home\//, | |
cb: function(req, res) { |
This file contains hidden or 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
<!-- Socket.io Library Include --> | |
<script src="https://raw.github.com/LearnBoost/socket.io-client/master/dist/socket.io.min.js"></script> | |
<!-- Page Structure --> | |
<ol id="messages"></ol> | |
<input type="text" id="message"> | |
<input type="button" id="send" value="Send"> | |
<!-- Styling --> | |
<style> | |
.msg_to, .msg_from { | |
list-style: none; |
This file contains hidden or 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 Queue = function(parts) { | |
var index = 0; | |
this.read = function() { | |
var part = parts[index]; | |
index++; | |
return part; | |
}; | |
this.next = function() { | |
var thiz = this; |
This file contains hidden or 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 color = function(wavelength) { | |
var bounds = [380, 440, 490, 510, 580, 645, 780]; | |
var pairs = ["BR", "BG", "GB", "GR", "RG", "R"] | |
var colorGen = function(combo, borders, wl) { | |
var RGB = {R:0,G:0,B:0}; | |
RGB[combo[0]] = 255; | |
RGB[combo[1]] = 255 * (borders[1] - wl)/(borders[1] - borders[0]); | |
return RGB; | |
}; | |
var residuals = bounds.map(function(bound){return bound-wavelength}).map(Math.abs); |
This file contains hidden or 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
#pragma config(Sensor, S1, IR, sensorI2CCustom) | |
//#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop) | |
//#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop, reversed) | |
/* | |
TO-DO | |
- find real value of timeEnd | |
- find motor strengths | |
- find left and right motors | |
*/ |
This file contains hidden or 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
module Main where | |
grid range = [[i,j] | i <- range, j <- range] -- construct grid of number pairs | |
multiplicationTable grid = map (\l -> foldl (*) 1 l) grid -- multiply said pairs | |
isPrime number = not $ any (==number) $ (multiplicationTable . grid) [2 .. number] -- check for presence in table | |
main = print $ map (\p -> (fst p, (isPrime . fst) p)) [(i, b) | i <- [1 .. 100], b <- [True]] -- map all numbers to primeness |