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
| # Elementary List Functions | |
| cons = (a, b) -> (option) -> switch option | |
| when true then a | |
| else b | |
| nil = null | |
| atom = (x) -> typeof(x) != 'function' | |
| car = (x) -> x(true) | |
| cdr = (x) -> x(false) | |
| # Functions on Recursive Pairs |
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(Motor, motorA, leftMotor, tmotorNXT, PIDControl, encoder) | |
| #pragma config(Motor, motorB, rightMotor, tmotorNXT, PIDControl, encoder) | |
| #pragma config(Sensor, S4, colorSensor, sensorCOLORFULL) | |
| #include "Simple Car Header.c" | |
| /* | |
| ___________________________________ | |
| | | | |
| | /========================\ | | |
| | | AUTOMATED PERIOD DIAGRAM | | |
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 req = http.request({ | |
| mathod: 'GET', | |
| host: 'brightcove03-f.akamaihd.net', | |
| path: '/2012rebroadcastHD_dci_live@55848?videoId=2407134469001&lineUpId=&pubId=27638699&playerId=1684416337001&affiliateId=&v=2.11.3&fp=MAC%2011,7,700,203&r=SLZWK&g=RYSHXMKECKNV&seek=251.097', | |
| port: '80' | |
| }, function(resp) { | |
| resp.pipe(fs.createWriteStream(__dirname + '/movie.flv')); |
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'); | |
| var exec = require('child_process').exec; | |
| var repo = "https://github.com/mattneary/Watterson-Dresses.git"; | |
| http.createServer(function(req, res) { | |
| exec("rm -rf /home/ec2-user/sites/Watterson-Dresses", function(err, stdout, stderr) { | |
| if( err ) { | |
| res.writeHead(400); | |
| res.end("error: "+JSON.stringify(err)) | |
| return; |
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 net = require('net'); | |
| var httpProxy = require('http-proxy'); | |
| var sites = [{ | |
| domain: "bwhs.me", | |
| path: __dirname + "/sites/Watterson-Dresses/server.js", | |
| port: 3001 | |
| }]; | |
| var options = { |
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 |
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
| 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
| 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
| <!-- 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; |