github.com

...ve forked it so it works for Rails 2.3.x applications running on Ruby 1.9. [1] makandra/mongomapper is based on the "official" rails2 branch [2] which contains commits that were...

...added after 0.8.6 was released. Tests are fully passing on our fork for Ruby 1.8.7, REE, and Ruby 1.9.3. To use it, add this to your Gemfile: gem 'mongo_mapper...

I had this error: > gem install bundler Successfully installed bundler-2.0.1 1 gem installed > bundle install Traceback (most recent call last): 2: from /home/henning/.rbenv/versions/2.5.1/bin/bundle:23:in ` ' 1: from /home/henning/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb...

...Probably missing gem: ' + gem_name print 'Auto-install it? [yN] ' gets.strip =~ /y/i or exit(1) system(install_command) or exit(1) # retry Gem.clear_paths puts 'Trying again ...' require gem_name...

...cause flaky tests Load rbenv on session create Load nvm on session create (part 1 and part 2) Add an open alias

...By default, output is sorted by directory name, not size: du -h --max-depth=1 . 40K ./a 2.3G ./b 3.1M ./c 500M ./d 2.8G .

...h switch does the magic of understanding humanized size formats): du -h --max-depth=1 . | sort -h 40K ./a 3.1M ./c 500M ./d 2.3G ./b 2.8G .

A haml angular 1 template with .thing(class="is-{{:: item.type }}") will be compiled (by haml) to which is not what you want! It will also crash in angular (unless thing...

...with Error: [$parse:syntax] Syntax Error: Token 'thing' is an unexpected token at column 11 of the expression [item.type thing] Solution 1: Use ng-class instead of class

css-tricks.com

...linked article shows what current browsers do when you click a link like this: 1-562-867-5309 Spoiler: The current state is sad It's still the case that...

...database in order to import the dump. If any problems occur, proceed as follows: 1. Figure out the original migration status of the dumpfile Convert your dump to plaintext: pg...

...git log --reverse ./db/migrate/20200729124233_add_users.rb commit d4848ad598b2f02cbca7580a2b928d02996abeb4 Author: Some user <some.user@example.com> Date: Thu Jul 30 16:07:51 2020 +0200 Add users commit 7b7fa26b838e576a70dee79d71f194f6a673c500 Author: Some user <some.user@example.com> Date: Tue Aug...

...date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch..merge in git-config(1...

In shell scripts you can use $1 to refer to the first argument, $2 for the second, etc. If you want to refer to all arguments (e.g. when writing a...

...and passes them on to another call), you may not want to do a “$1 $2 $3 $4 ...”. Use $@ instead, like in this script: $ cat welcome #!/bin/bash

...as #html_safe will lead to unexpected behavior. E. g. backreferences to captured groups ($1, $2) will be nil even if the group was matched. There is no universal workaround...

...to still be safe after using gsub on them. You can, however, fix the $1 gsub behavior on html_safe strings...

apidock.com

...1,2,3,4].sample # => e.g. 4 If you'd like to cheat and give different weights to each element in the array, you can use the attached initializer to...

[1,2,3,4].weighted_sample([1,1,1,1000])

github.com

...Cucumber uses mocha. This note shows to use RSpec stubs and mocks instead. Rspec 1 / Rails 2 Put the following into your env.rb: require 'spec/stubs/cucumber' Rspec 2 / Rails 3

...other request like from ActionCable. Then just set the maximum number of workers to 1 and the other requests have to wait. UNICORN_WORKERS=1 rails server

def all_tags virtual_tags + tags end end > Post.new.virtual_tags => [] # ✔ > Post.find(1).virtual_tags => nil # ☹ > Post.find(1).all_tags => Error: undefined method '+' for nil:NilClass

iana.org

...file to use them (for example like this): file = @attachment.file.path file_extension = File.extname(file)[1..-1] options = {} options[:type] = Mime::Type.lookup_by_extension(file_extension).to_s send_file file...

When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm

makandra dev
gozer.ectoplasm.org

When used to do: $> cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Xeon(TM) CPU 3.00GHz stepping : 1

...Instead, on Solaris, use psrinfo(1M) $> psrinfo -v Status of virtual processor 0 as of: 09/17/2006 21:45:32 on-line since 08/24/2006 16:16:03. The i386 processor operates...

makandra Operations

If you imagine there is something like ncdu or du -ha -d 1 /foo/bar you're wrong. If you want to get the size of all subdirs you...

...object, Ruby calls #to_a on the object: o = String.new('O') def o.to_a [1,2,3] end a, b, c = o # Implicit call to #to_a here

...can manually calculate the quarter index like (Date.parse('2011-02-10').month / 3.0).ceil #=> 1 Yes, you do actually divide by 3.0, not 4.0. MySQL has SELECT QUARTER...

...1...

...number of blank forms: Number of actors Number of blank actor forms 0 5 1 5 2 5 3 5 4 6 5 7 6 8 Luckily, there's an...

crazylittlehacks.blogspot.com

...This does not play too nice with Visor, because Visor will always be "window 1" for AppleScript. By modifying the script and replacing in window 1 with in window...

...users GROUP BY name; With ONLY_FULL_GROUP_BY this now explodes with: ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated...

You need to make sure that any selected value is either (1) the value you group by or (2) passed to an aggregate function like MIN or...