Creating Filesystems with Ruby and FUSE
The FUSE project allows you to create filesystems in userspace - which means you can create a filesystem without having to get your hands dirty and modify your kernel source. This is insanely cool, and can be used for many purposes. Here we're going to look at using the Ruby bindings to create a simple filesystem.
Related cards:
Ruby: Fixing strings with invalid encoding and converting to UTF-8
When dealing with external data sources, you may have to deal with improperly encoded strings.
While you should prefer deciding on a single encoding with the data-providing party, you can not always force that on external sources.
It gets worse wh...
Deal with different ways of counting weeks and weekdays in Ruby
Depending on where you live, different rules are used to determine the number of the week and a weekday. You have no chance whatsoever to get this...
Installing therubyracer and libv8 with Ruby 1.8 on OSX Mavericks
There seems to be no way to use therubyracer -v '0.11.4'
and libv8 -v '3.11.8.17'
on OS X Mavericks.
However, running bundle update therubyracer
worked for me. It installed therubyracer -v '0.12.1'
and libv8 -v '3.16.14.3'
and I had not...
Ruby: Natural sort strings with Umlauts and other funny characters
Why string sorting sucks in vanilla Ruby
Ruby's sort
method doesn't work as expected with special characters (like German umlauts):
["Schwertner", "Schöler"].sort
# => ["Schwertner", "Schöler"] ...
"cannot load such file -- nokogiri/nokogiri" (or any other Gem with native extensions on rvm and Ruby >= 2)
After running bundler / gem install I could not load nokogiri lately. It died with cannot load such file -- nokogiri/nokogiri
.
This is not a problem of the gem but is due to a broken native extensions installation routine.
When installing nokog...
Ruby 1.8.7: Bundler crashes with "deadlock" and core dump
Error
deadlock 0x7f8a4160a360: sleep:- (main) - /home/me/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/bundler-1.14.3/lib/bundler/worker.rb:43
deadlock 0x7f8a38c03b08: sleep:- - /home/me/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/ge...
Freeze (vendor, unpack) a single Ruby gem with and without Bundler
When you need to patch an existing gem, one way is to "vendor" the gem by copying it into the vendor/gems
directory of your Rails project. You can then make any changes you require and Rails will use the vendored version of the gem after a serve...
Using PostgreSQL and jsonb with Ruby on Rails
Postgres 9.4 introduces a new column type: jsonb
. json
and jsonb
columns store data differently, so just compare the two when you want to store JSON data and choose the one that matches your use case best.
Rails 4.2 includes support for `js...
Ruby: control flow with throw and catch
This article will show you how to use throw
and catch
. It's a nice tool to break out of multiple loops when a result is obtained.
Also see our card [Ruby: A ...
Cross-Domain Data with Rack and Rails | Union Station
Asynchronous JavaScript and CSS, also known as CSSHttpRequest, is a method of URI-encoding data in 2KB chunks split over several CSS rules with a modified data URI scheme. Because CSS is not subject to the same-origin policy, no service proxy is r...