Skip to content

Instantly share code, notes, and snippets.

View maxwellE's full-sized avatar
🤔

Maxwell Elliott maxwellE

🤔
View GitHub Profile
@maxwellE
maxwellE / primes.rb
Created December 15, 2012 01:21
Calculating Primes in Ruby
def isPrimeRegexp n
"1" * n =~ /^1?$|^(11+?)\1+$/
end
@maxwellE
maxwellE / mt2.md
Created December 10, 2012 03:53
mt2

I am still working on grading the midterms and hope to be done before class. In the meantime, here are some detailed comments on individual questions, based on what I have seen so far: [I haven't proofread this, sorry for any typos]:

  1. This was about type errors being caught more easily in the OO approach. Most people got this. The point is that since nodes that are instances of a given non-terminal are represented as objects that are instances of the corresponding class, there being one class for
@maxwellE
maxwellE / mt1.md
Created December 10, 2012 03:52
mt1 sol

I am still working on grading the midterms and hope to be done before class. In the meantime, here are some detailed comments on individual questions, based on what I have seen so far; sorry, I have not proofread these comments so there may be mistakes/typos:

  1. This was about the use of intermediate languages in compilers and interpreters. Many got parts of this wrong. For example, using int. lang. doesn't improve efficiency; it can even reduce it (because of compiling in two stages rather than directly to machine language).
@maxwellE
maxwellE / review.md
Created December 9, 2012 00:11
neelam review

Below is a list of the topics we have talked about in the course. You can expect questions on most of these topics. Mostly conceptual questions, but there will be some questions that ask you to write some code too (including in Scheme). In other words, the finals will be like the mid-terms. A single cheat-sheet is allowed.

I don't know if I will be able to post a sample final. If you have questions, please email or post or stop by during my office hours (Thursday at 1-2, and Monday at 11-12).

@maxwellE
maxwellE / rbconf.rb
Created October 4, 2012 03:35
Automated Twillio RubyConf ticket avaliability checker
require 'mechanize'
require 'twilio-ruby'
# Need to save a file with the html body to refer to later in the script since this is run
# in a cron job.
if File.exists?("rubyregistration.html")
body = File.read("rubyregistration.html")
else
File.open("rubyregistration.html","w+") do |file|
@maxwellE
maxwellE / .vimrc
Created May 15, 2012 18:23
my vimrc
call pathogen#infect()
filetype plugin indent on
set background=dark
colorscheme Tomorrow-Night
set number
set guifont=Monaco:h12
set tabstop=2 shiftwidth=2 expandtab
" Intuitive backspacing in insert mode
set backspace=indent,eol,start