Skip to content

Instantly share code, notes, and snippets.

View altamic's full-sized avatar

Michelangelo Altamore altamic

View GitHub Profile
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe 'Machinist' do
models = Dir[File.expand_path(File.dirname(__FILE__) + '/../app/models/*.rb')].
map{|file| File.basename(file, '.rb') } - %w{mailer}
models.map{ |model| model.classify.constantize }.each do |model|
it "should have a blueprint for the #{model} model" do
model.make.should be_instance_of(model)
end
# java resource bundles initializer
if defined?(JRUBY_VERSION)
# include config directory in the class path
$CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/"
# because ResourceBundle.getBundle doesn't seem to use the JRuby class loader,
# we need to pass it explicitly.
def load_resource_bundle(basename, lang = java.util.Locale::ENGLISH)
resource_path_name = Rails.root + 'config' + 'properties.xml'
resource_properties = java.util.Properties.new
resource_properties.load_from_xml(java.io.FileInputStream.new(resource_path_name.to_s))
# resource_properties['my.key'] # => 'value'
resource_properties.store_to_xml(java.io.FileOutputStream.new(resource_path_name.to_s), 'jruby rulez')
#pdf_link a:after {
content: "<" attr(href) ">";
}
require 'observer'
class Iraci < Struct.new(:name, :birth_date)
include Observable
def birth!
self[:birth_date] = Time.now.strftime('%d %B')
changed
notify_observers(name, birth_date)
end
end
# Simple BASH function that shortens
# a very long path for display by removing
# the left most parts and replacing them
# with a leading ...
#
# the first argument is the path
#
# the second argument is the maximum allowed
# length including the '/'s and ...
#
require 'formula'
class GstPluginsGl < Formula
url 'http://www.gstreamer.net/src/gst-plugins-gl/gst-plugins-gl-0.10.1.tar.gz'
homepage 'http://www.gstreamer.net/src/gst-plugins-gl/'
md5 '81c098243702c0f22db1527d0077d7bf'
def install
system "./configure", "--prefix=#{prefix}"
system "make install"
$ GST_DEBUG=*:2 gst-launch videotestsrc ! glimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Caught SIGSEGV accessing address 0x79
#0 0x00007fff82b6adce in select$DARWIN_EXTSN ()
#1 0x0000000100197e92 in g_poll ()
#2 0x0000000100187bed in g_main_context_iterate ()
#3 0x0000000100187fb5 in g_main_loop_run ()
#4 0x0000000100019700 in gst_bus_poll ()
#5 0x0000000100001acb in dyld_stub_g_str_has_prefix ()
function compush {
MSG="update"
if [ "$1" = "-m" ] ; then
MSG="$2"
shift
shift
fi
FLAGS=""
if [ "$#" = 0 ] ; then
@altamic
altamic / strftime.txt
Created September 17, 2010 12:29
STRFTIME
STRFTIME(3) BSD Library Functions Manual STRFTIME(3)
NAME
strftime, strftime_l -- format date and time
The conversion specifications are copied to the buffer after expansion as
follows:
%A is replaced by national representation of the full weekday name.