Skip to content

Instantly share code, notes, and snippets.

Boot Error
Something went wrong while loading /Users/vidmantas/Projects/myga/config.ru
NameError: uninitialized constant Hanami::Config::Mapper::Youtrack
/Users/vidmantas/.rvm/gems/ruby-2.3.3/gems/hanami-0.9.1/lib/hanami/config/mapper.rb:21:in `eval'
/Users/vidmantas/.rvm/gems/ruby-2.3.3/gems/hanami-0.9.1/lib/hanami/config/mapper.rb:21:in `eval'
/Users/vidmantas/.rvm/gems/ruby-2.3.3/gems/hanami-0.9.1/lib/hanami/config/mapper.rb:21:in `block in to_proc'
/Users/vidmantas/.rvm/gems/ruby-2.3.3/gems/hanami-router-0.8.1/lib/hanami/router.rb:268:in `instance_eval'
module WatirHelper
def self.initialize_watir
profile = Selenium::WebDriver::Firefox::Profile.new
begin
profile.add_extension "./lib/support/selenium/JSErrorCollector.xpi"
rescue
p "Cannot add JSErrorCollector.xpi to profile"
end
profile['app.update.auto'] = false
meld
Couldn't bind the translation domain. Some translations won't work.
'module' object has no attribute 'bindtextdomain'
(process:46865): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
/usr/local/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
/usr/local/Cellar/meld/1.8.6/libexec/bin/meld:155: GtkWarning: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
gtk.icon_theme_get_default().append_search_path(meld.paths.icon_dir())
The most elegant solutions are always the simplest.
As an 18xx series, ive done plenty of tandem training with my fellow Abrams operators, and what holds them up is typically the same thing that holds us up:
Destroyed tracks via steel cable or concertina wire
It doesnt take much. A steel cable or wire wrapped up in the tracks of a tank (or any other tracked vehicle) will stop it immediately. Simply place the wire or cable at odd angles in areas the tanks are operating, and they will get wrapped in either the road wheels or idler wheels.
This is a big deal because not only is the vehicle basically "dead" in the sense that it cannot move (you cant really operate or maneuver warfare if the vehicle can't drive), but in order to fix the vehicle you have to either A. tow it, which is a hassle in and of itself, or B. "throw track", where you pull the tracked component, by hand, off of the vehicle and replace it upon pulling out the wire or cable, which can take, at a minimum, hours.
class House
def initialize(floors, width, height)
@floors = floors
@width = width
@height = height
end
def floors
puts @floors
end
@vidmantas
vidmantas / gist:c76f36b21a159b841877
Last active August 29, 2015 14:10
#2 užduotis
require 'json'
class Wifi
def initialize(name, &block)
@root_node = name
@json = { @root_node => { } }
instance_eval(&block)
end
arr = [1,2,3]
sorted = arr.sort do |a, b|
if b == 2
1
else
a <=> b
end
end
@vidmantas
vidmantas / gist:5973700
Created July 11, 2013 08:43
OJ vs YAJL
ruby oj_vs_yajl_bm.rb
user system total real
yajl parsing: 5.840000 0.010000 5.850000 ( 5.868295)
oj parsing: 1.610000 0.140000 1.750000 ( 2.056829)
yajl dump: 5.890000 0.000000 5.890000 ( 5.911014)
oj dump: 1.270000 0.000000 1.270000 ( 1.277446)
source:
@vidmantas
vidmantas / BigDecimal
Last active December 11, 2015 15:08
Some naive bigdecimal comparison
require 'bigdecimal'
require 'benchmark'
n = 100_000
Benchmark.bm do |x|
x.report("float") { n.times{ 15.0 / 13.2; 15.0 * 13.2; 15.0 - 13.2; 15.0 + 13.2 } }
x.report("bd on the fly") do
n.times do
BigDecimal.new("15.0") / BigDecimal.new("13.2")
BigDecimal.new("15.0") * BigDecimal.new("13.2")
@vidmantas
vidmantas / gist:2988862
Created June 25, 2012 14:08
undefined method 'post'
# file located spec/mapi/v1/authentication_spec.rb
# exception:
# NoMethodError:
# undefined method `post' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xc652514>
# # ./spec/mapi/v1/authentication_spec.rb:6:in `block (3 levels) in <top (required)>'
require 'spec_helper'
describe Mapi::V1::SessionsController, :type => :api do
context 'unsuccessful authentication' do