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
module Util | |
def mongo_cluster_command_line_options | |
# | |
Mongoid.default_client # Force the setting to be parsed | |
settings = Map.for(Mongoid.clients[:default]) | |
address = settings[:uri] | |
# | |
unless address && address =~ %r`://` | |
raise("no uri in #{ settings.inspect }") |
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
# sometimes you need to calculate the rails_root from a subdirectory of a rails' app, eg, lib/capistrano/tasks/db.rake | |
# this code does it properly, but is verbose. golf it! | |
# | |
rails_root = File.expand_path(Dir.pwd) | |
until rails_root == '/' | |
if %w[ Gemfile app public ].all?{|entry| test(?e, "#{ rails_root }/#{ entry }")} | |
break | |
else | |
rails_root = File.dirname(rails_root) |
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
@jamesosel | |
RT @HorsleyScott: Sad news, close to home: NPR newsman Carl Kasell dies at age 84. He was a consumate broadcaster and a gentle man. | |
-- | |
@jamesosel | |
RT @davidmackau: my kink is hannity's own guest chiding him for not disclosing his cohen link https://t.co/Jiy4O65PoO | |
-- | |
@jamesosel | |
RT @ddale8: Perpetrator of Quebec City mosque massacre was a Trump devotee, took a selfie wearing a MAGA hat, closely followed… https://t.co/vHg5gqmhMx | |
-- | |
@jamesosel |
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 'minitest/unit' | |
require 'minitest/spec' | |
require 'minitest/autorun' | |
## | |
# | |
MiniTest::Unit::TestCase.i_suck_and_my_tests_are_order_dependent! |
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
# you should rely ONLY in the class level interface in your views, aka | |
# | |
# Asset.thumbnail(path, :dimensions => '42x42').url | |
# | |
# Asset.bw(path).url | |
# | |
# and no lib internals for now - this is under development | |
# | |
# this lib handles a few things in a simple interface. highlights: | |
# |
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
=begin | |
1) save this file in the rails_root as 'a.rb' | |
2) run | |
~> ./bin/rails runner a.rb | |
3) it should print out something like |
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
show = proc do |a| | |
"#{ a.class.name }[account: #{ a.account.slug.inspect }, name: #{ a.name.inspect }, id: #{ a.id }]" | |
end | |
audience = Audience.where(:id => '5a87337cbfe1a449740024db').first | |
audience.destroy | |
puts "DESTROY: #{ show[audience] }" | |
puts | |
Audience.all.each do |doc| |
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
show = proc do |a| | |
"#{ a.class.name }[account: #{ a.account.slug.inspect }, name: #{ a.name.inspect }, id: #{ a.id }]" | |
end | |
audience = Audience.where(:id => '5a87337cbfe1a449740024db').first | |
audience.destroy | |
puts "DESTROY: #{ show[audience] }" | |
puts | |
Audience.all.each do |doc| |
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
# ref: http://www.jsonrpc.org/specification | |
# | |
# stdlibs | |
# | |
require 'net/http' | |
# gems | |
# | |
require 'addressable/uri' |
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 WebpackController < ApplicationController | |
include ReverseProxy::Controller | |
# https://stackoverflow.com/questions/10883211/deadly-cors-when-http-localhost-is-the-origin | |
# | |
layout false | |
HEADERS = | |
{ | |
# |