user system total real
fib 1000 0.000000 0.000000 0.000000 ( 0.001114)
fib 10000 0.010000 0.000000 0.010000 ( 0.016190)
fib 100000 0.640000 0.090000 0.730000 ( 0.564936)
fib 500000 14.650000 3.230000 17.880000 ( 12.655379)
fib 1000000 56.280000 10.130000 66.410000 ( 46.374916)
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
| require 'set' | |
| # monkey path String for simplicity and readability | |
| class String | |
| def normalized | |
| # replace all non-alphabet characters with nothing | |
| downcase.gsub(/[^[:alpha:]]/, '') | |
| end | |
| def anagram_id |
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 Anagram | |
| def initialize(str) | |
| @str = str | |
| end | |
| def normalized | |
| @str.split('?').map do |word| | |
| # replace all non-alphabet characters with nothing | |
| word.downcase.gsub(/[^[:alpha:]]/, '') | |
| 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
| type Weight = Weight of int | |
| type Temperature = Temperature of int | |
| type Capacity = Capacity of Weight | |
| type Goldilocks = { | |
| Weight:Weight | |
| MaxTemp:Temperature | |
| } | |
| type Chair = { |
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
| type FiniteAutomataRule<'State, 'Input> = { | |
| State:'State | |
| Input:'Input | |
| NextState:'State | |
| } | |
| type DoorState = | |
| | Open | |
| | Closed | |
| | Opening |
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
| // a recursive type | |
| type AnonResult<'T> = | |
| | Value of 'T | |
| | Fn of ('T-> AnonResult<'T>) | |
| // only accepts functions that take two args | |
| let rec create (fn : 'T -> 'T -> 'T) = | |
| // this can probably be achieved more idiomatically with recursion | |
| // but the mutation is localised... | |
| let mutable accumulatedValue : 'T option = 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
| require 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| context "GET index" do | |
| #context "POST create" do | |
| #context "GET show" do | |
| #context "PATCH update" do (or PUT update) | |
| #context "DELETE destroy" do | |
| #context "GET new" do |
I hereby claim:
- I am damonmcminn on github.
- I am damonmcminn (https://keybase.io/damonmcminn) on keybase.
- I have a public key whose fingerprint is 5952 35E5 9861 4110 D68C 3BFD 0D2B 5D7A 00B5 CFAB
To claim this, I am signing this object:
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
| <?php | |
| $begin = new DateTime('now'); | |
| $beginformat = $begin->format("Y-m-d"); | |
| $beginfinal = strtotime($beginformat); | |
| $end = $begin->modify("+90 day"); | |
| $endformat = $end->format("Y-m-d"); | |
| $endfinal = strtotime($endformat); | |
| $dates = array(); |
NewerOlder