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
[email protected] | Stefanie | House | |
---|---|---|---|
[email protected] | Dinah | Erickson | |
[email protected] | Melisa | Reynolds | |
[email protected] | Lily | Carson | |
[email protected] | Millard | Rubio | |
[email protected] | Octavia | Santana | |
[email protected] | Royal | Bender | |
[email protected] | Laverne | Hutchins | |
[email protected] | Sherman | Wilder | |
[email protected] | Thelma | Burris |
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
#! /usr/bin/env ruby | |
require 'socket' # needed for creating tcp servers | |
require 'base64' # we'll use base64 for encoding images and embedding them in the response | |
require 'cgi' # has a lovely helper method for generating rfc1123 compliant dates for http headers | |
refresh_rate = 1 # in seconds, interval between each screen capture | |
server = TCPServer.open 3005 # start our server at port 3005 | |
# the html page template we'll be sending over to the browser | |
page_tmpl = %Q[ |
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
(* taking out the big guns, yes... size matters *) | |
open Num | |
open Printf | |
(* a throw away helper function just like pred but works with Nums, ought to give it a better name *) | |
let pred' n = Int (pred (int_of_num n)) | |
(* field test *) | |
let rec fact x = if x =/ Int 0 then Int 1 else x */ fact (pred' x) |
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
(100..999).to_a.repeated_permutation(2).collect{|x| x[0] * x[1] if "#{x[0] * x[1]}" == "#{x[0] * x[1]}".reverse }.compact.max |
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(problem_4). | |
-export([solve/0]). | |
solve() -> | |
List = lists:seq(100, 999), | |
[H | L] = [X * Y || X <- List, | |
Y <- List, | |
integer_to_list(X * Y) =:= lists:reverse(integer_to_list(X * Y))], | |
solve(L, H). |
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
(f=->*a{a[2]+=a[1]%2==0?a[1]:0;a[0],a[1]=a[1],a[1]+a[0];a[0]>=a[3]||a[1]>=a[-1]?a[2]: f[*a]})[1,2,0,4000000] |
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
(l ,ss = 4000000, proc {|p, n, s| p >= l || n >= l ? s : n.even?? ss[n, n + p, s + n] : ss[n, n + p, s] })[1][1, 2, 0] |
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(problem_2). | |
-export([s/0]). | |
-define(L, 4000000). | |
s() -> s(1, 2, 0). | |
s(P, N, S) when P >= ?L; N >= ?L -> S; | |
s(P, N, S) -> S1 = case N rem 2 of 0 -> N + S; _ -> S end, s(N, P + N, S1). |
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(problem_2). | |
-export([solve/1]). | |
-define(LIMIT, 4000000). | |
%% Normalizing the start value, need to start with an odd value and enter tail recursion | |
solve(Start) when Start rem 2 == 0, Start > 0 -> solve(Start - 1, Start, 0); | |
solve(Start) -> solve(Start, Start + 1, 0). | |
%% guard against the limit and drop out of recursion if we hit it | |
solve(Prev, Next, Sum) when Prev >= ?LIMIT; Next >= ?LIMIT -> Sum; | |
%% Sum even values |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
# For all responses in this controller, return the CORS access control headers. | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' |