Skip to content

Instantly share code, notes, and snippets.

$ ruby no-close.rb
$ cat foobar
hi
$
$ ~/jruby-1.3.1 no-close.rb
$ cat foobar
$
Title: Files are not flushed to disk unless explicitly 'close'd
Open files are not flushed to disk when an application exits. If the .close method is used, the files are correctly written to disk.
This little test-case illustrates the problem:
out = File.new('foobar', 'w')
out.write('hi')
out.puts
Title: Error message contains stale link to builting OpenSSL wiki page
While installing the rawr gem I got this error
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
That URL no longer exists and redirects to the main page.
Could you please update the error message with the new URL of that page?
@gioele
gioele / test-last-line-prawn.rb
Created January 15, 2012 13:43
Show "last line" rendering problem in Prawn
#!/usr/bin/env ruby
require 'prawn'
require "prawn/measurement_extensions"
paper_sizes = {
'A4' => [210, 297],
'A5' => [148, 210],
'A6' => [105, 148],
@gioele
gioele / working.rb
Created June 8, 2012 10:02
define_method on modules
#!/usr/bin/ruby1.8
class Main
module Extra
def define_fancy_method(method_name)
define_method(method_name) do |arg|
return [arg, arg].join(self.separator)
end
end
end
@import "compass/reset";
@import "susy";
$total-columns : 3;
$column-width : 80%;
$gutter-width : 20%;
$grid-padding : 0;
$container-width: 100%;
$container-style: fluid;
# Situation:
# * one laptop computer
# * one desktop computer
# * one remote server
# * one S3 bucket
#
# The laptop computer and the desktop computer have a directory ~/Docs with many GB of data.
# We do not want to download the data we already have
# Initial setup on the laptop computer
#!/usr/bin/env ruby
require 'nokogiri'
doc = Nokogiri::XML(%q{
<doc>
<sp id="sp1">
<speaker>Second</speaker>
<l n='5'>a</l>
<l n='8'>a</l>
@gioele
gioele / central-git-annex.sh
Last active August 29, 2015 14:03
git-annex repositories not seen when using sync without alwayscommit
#!/bin/sh -x
set -e ; set -u
export LC_ALL=C
h=${h:-localhost}
dr="/tmp/annex"
chmod a+rwx -R pc1 pc2 || true
rm -Rf pc1 pc2
@gioele
gioele / sync-doesnot-push.sh
Created July 11, 2014 09:09
git-annex sync does not push
#!/bin/sh -x
set -e ; set -u
export LC_ALL=C
d=$(pwd)
# cleanup
chmod a+rwx -R REPO pc1 || true
rm -Rf REPO pc1