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
[{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-05-22T00:00:00-06:00","end_at":"2017-06-21T23:59:59-06:00"},"principal":57702,"interest":83752,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-06-22T00:00:00-06:00","end_at":"2017-07-21T23:59:59-06:00"},"principal":56262,"interest":80629,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-07-22T00:00:00-06:00","end_at":"2017-08-21T23:59:59-06:00"},"principal":58577,"interest":82877,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"period":{"start_at":"2017-08-22T00:00:00-06:00","end_at":"2017-09-21T23:59:59-06:00"},"principal":59026,"interest":82428,"rate_annual":900,"service_fee":{"amount":0,"rate":0}},{"loan":{"id":1,"borrower_id":1,"amount":10984659,"term":120},"peri |
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 '[cljs.spec.alpha :as s]) | |
(require '[cljs.spec.test.alpha :as stest]) | |
(require '[expound.alpha :as expound]) | |
(require '[speculative.core]) | |
(set! s/*explain-out* (expound/custom-printer {:show-valid-values? true})) | |
(stest/instrument `map) | |
(try | |
(map 'lol 'lol) | |
(catch :default e | |
(println (.-message e)))) |
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 '[clojure.spec.gen.alpha :as sgen]) | |
;; original | |
(defn multimethod-selector | |
"Returns a generator that picks one dispatch value from the known | |
dispatch values of a multimethod. Defers the lookup of dispatch | |
values until sampling time, so any defmethods evaluated after the | |
generator is created may still be selected." | |
[s] | |
#(sgen/bind |
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 klipse-like.core | |
(:require [reagent.core :as r]) | |
(:import [goog.async Delay])) | |
(enable-console-print!) | |
(defonce !state (r/atom nil)) | |
(defn input* | |
"Like :input, but support on-change-text prop. Avoids mutability pitfalls of |
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
# -*- coding: utf-8 -*- | |
require "addressable/uri" | |
require "uri" | |
def uri_valid?(uri) | |
uri = Addressable::URI.parse(uri) | |
# If it could not be parsed, it won't have a valid scheme | |
%w{http https}.include?(uri.scheme) | |
rescue Addressable::URI::InvalidURIError | |
false |
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
# following is a little benchmark looking a real world example of inserting a | |
# bunch of records into pg and mongo using a few methods available in ruby. | |
# this is not meant to be an apples to apples benchmark, rather it's trying to | |
# see how the various dbs might perform in a real world situation. i know | |
# mongo does not fsync to disk. i know it's not fair using a transaction with | |
# the rdbms, but these conditions will exist in real world usage and it's that | |
# which i'm interested in. | |
# | |
# here is a few runs | |
# |
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
#!/usr/bin/env ruby | |
puts "looking for the gems to upgrade..." | |
gem_info = Struct.new(:name, :version) | |
to_reinstall = [] | |
Dir.glob('/opt/local/lib/ruby/gems/**/*.bundle').map do |path| | |
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/ | |
name, version = $1, $2 | |
bundle_info = `file #{path}` | |
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/ | |
end |