Skip to content

Instantly share code, notes, and snippets.

View tdouce's full-sized avatar

Travis Douce tdouce

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tdouce on github.
  • I am travisdouce (https://keybase.io/travisdouce) on keybase.
  • I have a public key ASCOi5Ic1-Bid0rd3McWGsXBFAjFw-vGHtoZ3TGNa4AR7Qo

To claim this, I am signing this object:

# option #1
# Granted, this would require that bugsnag be a dependency of the gem. And, that might
# not be an option. but, anyhoo
module Crex
# This could be a parent class that is configured in a similar way api_client gem does
class RescueStrategy
def self.call(e)
Bugsnag.notify(e)
end
end
@tdouce
tdouce / do-every-x-seconds.cljs
Created January 18, 2017 21:06
Execute js every x seconds
(defn the-loop
[pred-fn todo-fn count]
(.setTimeout
js/window
(fn []
(todo-fn count)
(let [count (* 2 count)]
(when-not (pred-fn count)
(the-loop pred-fn todo-fn count))))
3000))
@tdouce
tdouce / dedup-om-query.cljs
Last active January 13, 2017 19:26
dedup om query server side
(defn dedupe-query
[q]
(-> (reduce
(fn [query q]
(cond
(map? q)
(into query (mapcat val q))
:else
(conj query q)))
#{} q)
~/code/quantify (total-sales-total-revenue)$ docker run -p 9200:9200 elasticsearch:2.3.3
[2016-10-18 19:31:35,476][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: your kernel is buggy and you should upgrade
[2016-10-18 19:31:35,741][INFO ][node ] [Peregrine] version[2.3.3], pid[1], build[218bdf1/2016-05-17T15:40:04Z]
[2016-10-18 19:31:35,741][INFO ][node ] [Peregrine] initializing ...
[2016-10-18 19:31:36,455][INFO ][plugins ] [Peregrine] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2016-10-18 19:31:36,489][INFO ][env ] [Peregrine] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [12.8gb], net total_space [17.8gb], spins? [possibly], types [ext4]
[2016-10-18 19:31:36,489][INFO ][env ] [Peregrine] heap size [1015.6mb], compressed ordinary object pointers [true]
[2016-10-18 19:31:39,239][INFO ][node
@tdouce
tdouce / gist:d0499c882ad63a6e1774
Last active August 29, 2015 14:24
Branch name generator
#!/usr/bin/env ruby
def remove_unruly_chars(string)
string.downcase.gsub(/[\s\W]/, '_')
end
branch_name = ARGV[0]
story = ARGV[1]
branch = "travisdouce/#{ story + '-' if story }#{ remove_unruly_chars(branch_name) } "
@tdouce
tdouce / gist:52d6a42b8eedde53f47e
Last active August 29, 2015 14:08
Hash.new with a block
delete = []
create = []
def user_exists?(user_id)
[1,2].include?(user_id)
end
def create_user?(user_id)
[3,4].include?(user_id)
end
@tdouce
tdouce / spec_helper.rb
Last active August 29, 2015 14:08
"client" spec/spec_helper.rb
...
RemoteFactoryGirl.configure do |config|
config.home = { host: 'localhost',
port: 3001,
end_point: '/remote_factory_girl/home' }
config.return_with_root = false
end
RemoteDatabaseCleaner.configure do |config|
@tdouce
tdouce / remote_factory_girl_and_remote_database_cleaner_js_implementation
Last active November 9, 2015 23:11
remote_factory_girl and remote_database_cleaner js implementation
function remoteFactoryGirl(factoryName, attributes) {
var attributes = attributes || {};
var end_point = 'http://localhost:4000/remote_factory_girl/home';
var json;
$.ajax({
async: false,
url: end_point,
type: 'POST',
@tdouce
tdouce / Gemfile
Created July 9, 2014 01:53
Part of 'Testing Rails Service Oriented Architecture' blog
group :test do
gem 'remote_database_cleaner_home_rails'
gem 'database_cleaner'
end