Skip to content

Instantly share code, notes, and snippets.

@dball
dball / gist:2cebfd9e7a815f813eff
Created August 2, 2014 15:19
core.async flow limiter
(ns dball.util.async
(:require [clojure.core.async :refer [go-loop >! <! timeout close! chan dropping-buffer >!! alts!]]
[clojure.tools.logging :as log])
(:import [java.util.concurrent Executors ScheduledExecutorService TimeUnit]))
(defn ^ScheduledExecutorService scheduler
[]
(Executors/newSingleThreadScheduledExecutor))
(defn ticker-chan
@dball
dball / gist:7ab19a5b3c348db6949c
Last active August 29, 2015 14:10
Panicky pipeline
(ns transduction
(:require [clojure.core.async :as async]))
(defn panicky
[pipeline-fn n to xf from]
(let [errors (atom #{})
ex-handler (fn [ex]
(async/close! from)
(swap! errors conj ex))
rf (remove (fn [_] (seq @errors)))
require 'rational'
module Almost
EPSILON = 0.001
module InstanceMethods
def almost(epsilon = EPSILON)
Almost::Number.new(self, epsilon)
end
end
ossl.c:118: error: expected ‘)’ before ‘*’ token
ossl.c:119: error: expected ‘)’ before ‘*’ token
make[1]: *** [ossl.o] Error 1
make: *** [all] Error 1
[2010-09-03 11:03:54] make
ossl.c:118: error: expected ‘)’ before ‘*’ token
ossl.c:119: error: expected ‘)’ before ‘*’ token
make[1]: *** [ossl.o] Error 1
make: *** [all] Error 1
[2010-09-03 11:05:38] make
Process: JavaApplicationStub [79829]
Path: /Applications/Minecraft.app/Contents/MacOS/JavaApplicationStub
Identifier: com.Mojang Specifications.Minecraft.Minecraft
Version: Minecraft 1.0.0 (1.0.0)
Code Type: X86 (Native)
Parent Process: launchd [149]
Date/Time: 2010-09-21 11:20:02.865 -0400
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
module Liquid
class Variable
def render_with_html_escape(context)
output = render_without_html_escape(context)
if context.registers[:html_escape] && !output.html_safe?
ERB::Util::html_escape(output)
else
output
Donalds-Decisiv-MacBook-Pro:pricing-trunk dball$ git svn rebase
M test/unit/estimate_item_test.rb
M app/helpers/operations_helper.rb
M app/models/estimate_item.rb
M app/models/portal/group.rb
M app/concerns/broker_concerns.rb
M app/concerns/estimate_concerns.rb
M app/concerns/group_note_concerns.rb
M app/views/leftnav/_warranty_info.html.erb
Byte order is not compatible at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 380, at /opt/local/lib/perl5/5.8.9/Memoize/Storable.pm line 21
Factory.define(:passing_inspection_estimate, :parent => :estimate_with_items) do |f|
f.after_create do |e|
e.items << Factory(:estimate_item, :estimate => e, :inspection => true, :op => Factory(:inspection_op, :dealer => e.dealer)).tap do |item|
inspection = item.inspections.first
location = inspection.locations.first
outcome = inspection.failures.detect { |outcome| outcome.performed }
location.create_data!(:inspection_failure_id => outcome.id, :created_by => 'factory')
end
end
end
require File.dirname(__FILE__) + '/spades'
require 'minitest/autorun'
describe Deal do
before do
@deal = Deal.new
end
it "should default to 13 clubs dealt to the first player" do
class Deal
attr_accessor :clubs
def initialize
@players = (1..4)
@clubs = Array.new(13, @players.first)
end
def succ!