Skip to content

Instantly share code, notes, and snippets.

@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
class House
def initialize(floors, width, height)
@floors = floors
@width = width
@height = height
end
def floors
puts @floors
end
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.
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())
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
<% cat_opts = [] %>
<% Category.all.each do |c| %>
<% cat_opts << [c.name, c.id] %>
<% end %>
<%= f.select :category_id, cat_opts %>
<%= f.select :category_id, Category.all.map{ |c| [c.name, c.id] } %>
# in spec_helper.rb
config.mock_with :mocha
#...
end
# returns current fake user
def current_user
@current_user ||= User.make
%tr.fields
%td
= f.collection_select :product_id, Product.all, :id, :name
%td#price_unit
:javascript
$(function (){
new_id = $("#price_unit").prev("td").next("select").attr("class");
alert(new_id);
});
files = Dir.glob('dir/**/*')
output_to = File.open('result.txt', 'w')
for file in files
if file =~ /(rb|haml)$/ and !(file =~ /plugins/)
output_to.write "# FAILAS: #{file}"
output_to.write "\n"
output_to.write(File.read(file))
output_to.write "\n"
f = File.read("9niwrHXd.txt")
f.split("<url>").each do |e|
f.gsub!(e, '') if e =~ /aspx\?/
end
f.gsub!(/(<url>){2,}/, "<url>")
File.open("new.txt", "w") do |n|
n.write f
end