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
| Found by Dima Kovalenko | |
| Selenium specs which call "wait for element to be visible" fail on an "Element no longer connected to DOM" error. | |
| The problem occurs when the div appears briefly, then goes away. If the loop exits after the div is already off the screen, the call to "wait for element to be visible times out, and causes the spec to fail. | |
| This issue can be elusive, only failing intermittently because sometimes the loop exits quickly enough to avoid producing the error. The fact that the div is displayed then hidden was the key to identifying and solving this bug in our test. |
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 'openssl' | |
| class AppUser < Sequel::Model(:AppUsers) | |
| AppUser.unrestrict_primary_key | |
| def self.authenticate(username, password) | |
| #TODO: Store salt in config | |
| puts "In Auth" | |
| user = self.first(:username => username) |
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
| (ns game | |
| (:use clojure.test)) | |
| (defn vitality [cell-state live-neighbors] | |
| (or (= live-neighbors 3) (and cell-state (= live-neighbors 2)))) | |
| (defn count-live-neighbors [grid position] | |
| (let [row (first position) | |
| column (last position)] | |
| (def neighbors |
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 Player | |
| attr_accessor :warrior, :direction, :health, :hurt, :step | |
| def initialize | |
| self.direction = :backward | |
| self.hurt = false | |
| self.step = true | |
| end | |
| def play_turn(warrior) |
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 'sinatra' | |
| get '/' do | |
| @name = # GET GIST HERE!!! | |
| erb :home | |
| 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
| (ns anagram | |
| (:require [clojure.string :refer [lower-case split]])) | |
| (defn- duplicate? [a b] | |
| (= (lower-case a) (lower-case b))) | |
| (defn- unique-candidates [source candidates] | |
| (remove #(duplicate? % source) candidates)) | |
| (defn- canonicalize [word] |
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
| num = 1000000000000000000000000000000000000000000 | |
| (0..100).each_with_index {|n, i| puts n if num == 10 ** n } |
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
| koans: | |
| image: clojure | |
| command: lein koan run | |
| volumes: | |
| - ./clojure-koans:/clojure-koans | |
| working_dir: /clojure-koans | |
| repl: | |
| image: clojure | |
| command: lein repl |
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
| git log --oneline --after="2016-03-28" --before="2016-04-03" --pretty=format:"%ad, %s" --date=short |
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 User < ActiveRecord::Base | |
| DO_NOT_MODIFY = ["encrypted_password", "state"] | |
| def do_not_modify | |
| DO_NOT_MODIFY | |
| end | |
| def strip_string_attributes | |
| string_attributes.each do |k,v| | |
| # this is a side-effect and mutates instance state |