Skip to content

Instantly share code, notes, and snippets.

04ff3ee013708cdd82506ada5006e1e7f12a2de23a73f5d9ecd6e88237f2cfb4be6116553513be7cbbd6e12d4080750dc9d6008a1306a93280b2bfcc52a8e213eb
### Keybase proof
I hereby claim:
* I am corprew on github.
* I am corprew (https://keybase.io/corprew) on keybase.
* I have a public key whose fingerprint is B223 592D 6E6F 4C11 BEAD 9034 89DC 5BCB CFCA 4628
To claim this, I am signing this object:
Verifying that +corprew is my blockchain ID. https://onename.com/corprew
require 'prime'
# random question.
#
# Every Prime Number greater than or equal to 5 has the following property:
# if the number is squared and one is added, it will be evenly divisible by
# 24.
#
# Determine that divisor, and for each prime greater than or equal to 5 print
# out the difference between it and the divisor of the previous prime in the list
#

Keybase proof

I hereby claim:

  • I am corprew on github.
  • I am corprew (https://keybase.io/corprew) on keybase.
  • I have a public key whose fingerprint is B643 BFD7 B98B 1B9A A4A1 2F46 4255 39CF 6607 F98A

To claim this, I am signing this object:

@corprew
corprew / fizzbuzz.rb
Created June 17, 2012 21:02
the 'case' statement in ruby has some odd semantics for people who aren't used to it.
(0..100).each do |i|
puts case
when i%15==0
"fizzbuzz"
when i%5==0
"buzz"
when i%3==0
"fizz"
else
i.to_s
@corprew
corprew / dictionary.rb
Created September 20, 2011 08:29
dictionary for use in generating json
#
# Usage:
#
# a = Dictionary.new
# a[:someKey] << someHash
# a[:someKey] << someOtherHash
#
# a.to_json => {"someKey":[someHash,someOtherHash]}
#
# derived from code pulled out of some example on stackoverflow at some point in the distant past.
@corprew
corprew / moodle_20_get_teacher_replacement.php
Created August 24, 2011 05:33
replacement for the moodle 1.9 get_teacher function in mdl2.0's api.
# moodle 2.0 removes the get_teacher function as well as some of the other helper functions. In general,
# these functions were very useful for doing the sort of security tests that arise in an online school.
#
# still not sure why this function was eliminated, but it seems to be for largely ideological reasons around
# capabilities being the determining factor in education rather than 'names,' but is seems odd to assign a
# role to a user in a course and then test for an attribute of that role when you're writing checks rather
# than the role itself.
#
# where $course is the course object and $DB is as per usual for moodle 2.0.
#