Skip to content

Instantly share code, notes, and snippets.

View taylorlapeyre's full-sized avatar

Taylor Lapeyre taylorlapeyre

View GitHub Profile
it 'should be able to tell whether any open studios are visible' do
@open_studio.sticker_image = 'sticker image url'
@open_studio.active_rule = 'show_sticker'
expect(@open_studio.save).to be_true
expect(OpenStudio.active).to_not be_nil
end

Keybase proof

I hereby claim:

  • I am taylorlapeyre on github.
  • I am taylorlapeyre (https://keybase.io/taylorlapeyre) on keybase.
  • I have the public key with fingerprint AB1B EBEC F0DA 3CC9 43FA  73B4 A5FE F98C 15EF B3F2

To claim this, I am signing this object:

@taylorlapeyre
taylorlapeyre / guide.md
Last active August 29, 2015 13:56
Guides for developing our web application.

The Things

The Language

[Ruby][ruby] - a dynamic scripting language with a focus on simplicity

The Framework

[Rails][rails] - a popular MVC web framework built on ruby

@taylorlapeyre
taylorlapeyre / tutor.rb
Last active August 29, 2015 13:57
Quick attempt at Eric's thing in ruby, without dealing with arrays
class SpanishTutor
def initialize(path_to_dictionary)
@dictionary = parse_file(path_to_dictionary)
@num_incorrect = 0
@num_correct = 0
start_repl
end
def start_repl
loop do
/*
* int i = 0;
* int nl = 0;
* while (S[i]) {
* if (S[i] > 97 && S[i] < 122) {
* nl++;
* }
* i++;
* }
*/
getStuff = function() {
return {
url: window.location.href,
name: $('.full-name').html(),
title: $('.title').html(),
date: new Date(),
}
}
@taylorlapeyre
taylorlapeyre / answer.clj
Last active August 29, 2015 14:07
Answer
(defn abs [x]
"Returns x if the number is > 0, otherwise -x"
(if (neg? x) (- x) x))
(defn square [x]
"Squares the number"
(* x x))
(defn cube [x]
"Multiplies the square of the number by itself"
@taylorlapeyre
taylorlapeyre / description.md
Last active August 29, 2015 14:08
A clever problem for an interview or just for fun

Generating HTML

Say that one day we decide to write a new templating library for generating HTML.

In this new library, you are passed an array where the first element is the name of an HTML tag, the second element is optionally a hash containing the element's HTML attributes, and the rest of the elements are the HTML elements that are children of it.

For example:

html = [:html,
@taylorlapeyre
taylorlapeyre / clojure
Created December 6, 2014 22:47
An easy easy way to run Clojure.
#!/usr/bin/env bash
LEIN_URL=https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
function execute_clojure {
if [[ -d $HOME/.lein ]]; then
if [[ ! -f $HOME/.lein/profiles.clj ]]; then
echo '{:user {:plugins [[lein-exec "0.3.4"]]}}' > $HOME/.lein/profiles.clj
fi
else
(defn divisible?
"Returns true if the remainder of x / y is zero, else false."
[x y]
(zero? (rem x y)))
(defn fizzbuzz
"Returns Fizz if n is divisible by 3, buzz if n is divisible by 5,
and fizzbuzz if n is divisible by both."
[n]
(cond (divisible? n 15) "fizzbuzz"