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
RSpec.configure do |config| | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.order = "random" | |
config.fail_fast = true | |
config.filter_run :focus | |
config.filter_run_including :focused => true | |
config.run_all_when_everything_filtered = true | |
config.alias_example_to :fit, :focused => true |
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
1. Get lein | |
lein - http://leiningen.org/ | |
2. `lein new reagent <awesome-project>` | |
3. Some changes to project.clj from last night's talk: | |
:dependencies [[org.clojure/clojure "1.7.0-alpha4"] | |
[org.clojure/clojurescript "0.0-2371"] | |
[org.clojure/core.async "0.1.346.0-17112a-alpha"] | |
[reagent "0.4.3"] |
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 experimental fork of DataScript from https://github.com/allgress/datascript to handle undo and per-query subscriptions | |
(ns reagent-test.core | |
(:require [reagent.core :as reagent :refer [atom]] | |
[datascript :as d] | |
[cljs-uuid-utils :as uuid])) | |
(enable-console-print!) | |
(defn bind | |
([conn q] |
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
(ns freactive-datascript.core | |
(:require [datascript :as d] | |
[datascript.core :as dc] | |
[clojure.data :as data] | |
[freactive.core :as f :refer [IReactive | |
*invalidate-rx* | |
*trace-capture*]])) | |
;;; Playground ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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
<!doctype html > | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title></title> | |
</head> | |
<body> | |
<nav></nav> | |
</body> | |
</html> |
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
require 'active_record' | |
require "#{Rails.root}/app/models/user" | |
describe User do | |
it "does something sweet" | |
it "does something cool" | |
end |
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
# Do you ever define #method_missing and forget #respond_to? I sure | |
# do. It would be nice if we could do them both at the same time. | |
module MatchMethodMacros | |
def match_method(matcher, &method_body) | |
mod = Module.new do | |
define_method(:method_missing) do |method_name, *args| | |
if matcher === method_name.to_s | |
instance_exec(method_name, *args, &method_body) | |
else |
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 GroupOfThingies | |
attr_accessor :thingies | |
# Use like this: | |
# | |
# group_of_thingies = GroupOfThingies.new | |
# group_of_thingies.each do |thing| | |
# puts "Check out this awesome thing: #{thing}!" | |
# end | |
# |
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
get '/give/me/gazebo/not/gazelle/:min_size' do | |
pricing = PriceCalculator.new | |
ParamsExtractor.new(pricing).parse(params) | |
GazelleFinder.new(pricing).find_all_gazelles | |
GazelleFilter.new(pricing).remove_sick_gazelles # pricing has access to #gazelles | |
GazeboBuilder.new(pricing).calculate_size_of_gazebo | |
GazeboPricer.new(pricing).calculate_final_price # pricing no longer has #gazelles |
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
# https://gist.github.com/2032303 | |
module MiniTest::Assertions | |
def assert_palindrome(string) | |
assert string == string.reverse, "Expected #{string} to read the same way backwards and forwards" | |
end | |
def assert_default(hash, default_value) | |
assert default_value == hash.default, "Expected #{default_value} to be default value for hash but was #{hash.default.inspect}" | |
end |
OlderNewer