I hereby claim:
- I am hamled on github.
- I am hamled (https://keybase.io/hamled) on keybase.
- I have a public key whose fingerprint is 4F35 1CAF 0D0B 1D00 9CE4 CCF6 4265 F9D0 9BC1 D7EA
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
## Talking about Local Variables and Instance Variables | |
097 >local_variable = 10 | |
=> 10 | |
098 >@instance_variable = "hi" | |
=> "hi" | |
099 >Local_variable = 10 | |
=> 10 | |
100 >Local_variable | |
=> 10 | |
101 >def bob |
$ rspec spec | |
. | |
Finished in 0.00121 seconds (files took 0.17275 seconds to load) | |
1 example, 0 failures |
class Chair | |
def stack(another_chair) | |
if another_chair.nil? | |
return [self] | |
elsif another_chair.is_a? Chair | |
return [another_chair, self] | |
else | |
return another_chair.push(self) | |
end | |
end |
def find_movies(flight_length, movie_lengths) | |
movie_complements = Set.new | |
movie_lengths.each do |movie_length| | |
# We have a good movie pair if this length is the complement of a previous movie's length | |
return true if movie_complements.include? movie_length | |
# Otherwise, track the complement of this movie's length for checking against succeeding movie lengths | |
movie_complements << (flight_length - movie_length) | |
end | |
/* | |
* generate collisions for truncated md5 hashes | |
* e.g., substr(md5($pass), 0, 8) | |
* cc -o md5substr md5substr.c -march=native -O3 -funroll-loops -pthread | |
* | |
* Copyright 2013, epixoip. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* |
/* | |
* generate collisions for truncated md5 hashes | |
* e.g., substr(md5($pass), 0, 8) | |
* cc -o md5substr md5substr.c -march=native -O3 -funroll-loops -pthread | |
* | |
* Copyright 2013, epixoip. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* |
For this coding challenge/exercise I decided to restrict myself to only single-line responses. In order to achieve this I employ shell scripting to download the problem input, and Ruby code passed directly to an interpreter in order to transform it.
More important than the literal single-line nature of the code is the single "statement" aspect. I've prefered to use Ruby features and library methods that chain together, resulting in one long run-on
<petStore> | |
<pets> | |
<dog> | |
<id>515</id> | |
<name>Rusty</name> | |
<breed>ChocolateLabrador</breed> | |
</dog> | |
<dog> | |
<id>516</id> | |
<name>Lulu</name> |
# FIRST edit the next line to have the path to your project-forks folder | |
# Something like ~/Desktop/ada/project-forks | |
export PROJECTS=~/path/to/your/project-forks | |
# THEN run these lines (unmodified) | |
brew install python | |
pip install virtualenv | |
pip install virtualenvwrapper | |
echo "export WORKON_HOME=~/.virtualenvs" >> ~/.bashrc |