This file contains 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
I thought I'd jot down a few notes about our experience posting to <a href="http://news.ycombinator.com">hn</a>. | |
I had just finished "an acceptable code base" for <a href="http://www.chuwe.com">chuwe.com</a> (our Q&A site for the startup/smallbiz community) and decided that Sunday was the day. Actually, we decided Friday, but personnel issues pushed it back until Sunday. | |
Our goal was simple - it wasn't a "real" launch per se. We wanted to open the site, get mass feedback in one big jolt, then close it and continue with our original invite-only model. | |
A Short Crisis | |
In any case, we posted to HN - my first time showing personal code to so many people. It's difficult to tell if there will be any big problems ahead of time. To minimize the possibility, I followed BDD - we had functional-tests, unit-tests, etc. In fact, we had about a 1:1 code-to-test coverage ratio (whether that's meaningful or not, I don't know). Testing made refactoring fly by, it reassured me that things still worked, and just made m |
This file contains 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
; T). | |
; etc. | |
; --> LET IF LET PROG1 LET LET* MULTIPLE-VALUE-BIND LET UNLESS IF TYPEP LET AND | |
; --> IF AND THE LOCALLY AND THE >= IF | |
; ==> | |
; (< SB-C::X SB-C::Y) | |
; | |
; note: forced to do GENERIC-< (cost 10) | |
; unable to do inline fixnum comparison (cost 3) because: |
This file contains 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
sean-groves-macbook:bin sgrove$ lein install | |
Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (core.clj:1) | |
at clojure.lang.Compiler.eval(Compiler.java:5274) | |
at clojure.lang.Compiler.eval(Compiler.java:5250) | |
at clojure.lang.Compiler.load(Compiler.java:5663) | |
at clojure.lang.RT.loadResourceScript(RT.java:330) | |
at clojure.lang.RT.loadResourceScript(RT.java:321) | |
at clojure.lang.RT.load(RT.java:399) | |
at clojure.lang.RT.load(RT.java:371) | |
at clojure.core$load__5663$fn__5671.invoke(core.clj:4255) |
This file contains 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 Validated: | |
__fields__ = {} # field -> validator list | |
def validate(self): | |
errors = [] | |
for field, validators in self.__fields__.iteritems(): | |
if not hasattr(self, field): | |
errors.append("field %s missing" % field) | |
continue | |
field_errors = [] |
This file contains 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
# Sauce::Selenium_browsers will have all your browsers | |
JSON.parse(ENV["SAUCE_ONDEMAND_BROWSERS"]).each do |selenium_browser| | |
@browser = Selenium::Client::Driver.new(:host => ENV["SAUCE_ONDEMAND_SERVER"], | |
:port => ENV["SAUCE_ONDEMAND_PORT" ], | |
:url => ENV["SAUCE_ONDEMAND_URL" ], | |
:browser => selenium_browser, | |
:timeout_in_second => 90) | |
@browser.start_new_browser_session | |
@browser.open "/" |
This file contains 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
> (use-package :vana-inflector) | |
> (let ((dollars 1.7) | |
(users 34) | |
(purchases 1)) | |
(format nil "The site has ~D ~A, with a total of ~D ~A and $~D ~A" | |
users (pluralize users "user") | |
purchases (pluralize purchases "purchase") | |
dollars (pluralize dollars "dollar"))) | |
"The site has 34 users, with a total of 1 purchase and $1.7 dollars" |
This file contains 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
(defun pluralize (count word &optional plural) | |
(if (not (= count 1)) | |
(or plural | |
(plural-of word)) | |
word)) |
This file contains 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
(defun inflector-helper (word regexes) | |
(if (null regexes) | |
word | |
(multiple-value-bind (string match-found?) | |
(cl-ppcre:regex-replace (first (first regexes)) word (second (first regexes))) | |
(if match-found? | |
string | |
(inflector-helper word (rest regexes)))))) |
This file contains 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
(defun plural-of (word) | |
"Returns the plural of a word if it's singular, or itself if already plural" | |
(cond ((uncountable? word) word) | |
((irregular? word) (get-irregular-plural word)) | |
(t (inflector-helper word *plurals*)))) |
This file contains 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
(defun uncountable? (word) | |
(member word *uncountables* :test #'string-equal)) | |
(defun irregular? (word) | |
(or (-> word *irregulars*) | |
(rassoc word *irregulars* :test #'string-equal))) |
OlderNewer