MRuby by Example
In mean time I was playing with MRuby. Embeded it into a VST and describe in my last post. The results of it is an MRubyByExample. Its well documented snippets of C and ruby code used with MRuby. You can also compile it and see it working. Checkout github repository and execute rake. Compiled, documented, executed!19 April 2015MRuby within VST
From time to time, I want to just do something more than a Rails app. Recently I just looked at MRuby.13 April 2015Ember-cli with Coffee and Emblem
In mean time, I want to try ember.js app. Just an ember.js app without any backend. I really don’t like plain javascript. CoffeeScript it my choice, and of course emblem, slim like beautiful template engine. Get it on.9 April 2015My first textmate bundle
When I saw, that Textmate 2 supports gutter informations, I want to use it somehow. While is no good Rubocop bundle, I want to make my own. It supports different icons for all severities that rubocop reports. Check this out!27 November 20145 years later ...
Welcome BACK! After 5 years I decided to clean up my stuff. Blog is moved here on github page with jekyll. Many sites are unavailable because of hosting problems. I’m trying to move everything to my github.25 November 2014Moving from rubyforge to github
Finally I moved my rubyforge repositories to github and gems to gemcutter.org: gruby colorize RDoc documentation is now on rdoc.info. gruby colorize It was quite easy. But there is necessary to use jeweler ? The only thing I need is gemspec file. Build and push are made by gem. There is any thiny tool that can manage version and gemspec files ?23 November 2009My Player 2.0
Do you remember My Music Player ? I still hate myspace sites! Unfortunately AppJet hosting go down, but… Heroku comes in. My Player 2.0 is new webapp, is completely written in Ruby and Sinatra framework.13 November 2009What's wrong with You merb ?
If you get this … FATAL: The gem data_objects (= 0.9.11, runtime), [] was not found … try this …23 February 2009Using Mac Sudden Motion Sensor with RubyInline
Quick and dirt script for reading your macbooks sudden motion sensor: require 'rubygems' require "inline" class SMS class << self inline do |builder| builder.add_compile_flags '-x objective-c', '-framework IOKit' builder.include "<IOKit/IOKitLib.h>" builder.c %q{ VALUE values(){ struct data { unsigned short x; unsigned short y; unsigned short z; char pad[34]; }; kern_return_t result; mach_port_t masterPort; IOMasterPort(MACH_PORT_NULL, &masterPort); CFMutableDictionaryRef matchingDictionary = IOServiceMatching("SMCMotionSensor"); io_iterator_t iterator; result = IOServiceGetMatchingServices(masterPort, matchingDictionary, &iterator); if(result != KERN_SUCCESS) { return rb_str_new2("Error"); } io_object_t device = IOIteratorNext(iterator); IOObjectRelease(iterator); if(device == 0){ return rb_str_new2("Error"); } io_connect_t dataPort; result = IOServiceOpen(device, mach_task_self(), 0, &dataPort); IOObjectRelease(device); if(result != KERN_SUCCESS) { return rb_str_new2("Error"); } IOItemCount structureInputSize; IOByteCount structureOutputSize; struct data inputStructure; struct data outputStructure; structureInputSize = sizeof(struct data); structureOutputSize = sizeof(struct data); memset(&inputStructure, 1, sizeof(inputStructure)); memset(&outputStructure, 0, sizeof(outputStructure)); result = IOConnectMethodStructureIStructureO( dataPort, 5, structureInputSize, &structureOutputSize, &inputStructure, &outputStructure ); if(result != KERN_SUCCESS) { return rb_str_new2("Error"); } IOServiceClose(dataPort); VALUE coords = rb_ary_new2(3); rb_ary_store(coords, 0, INT2FIX(outputStructure.x)); rb_ary_store(coords, 1, INT2FIX(outputStructure.y)); rb_ary_store(coords, 2, INT2FIX(outputStructure.z)); return coords; } } end end end loop do x,y,z = SMS.values puts "#{x} #{y} #{z}" end8 December 2008Include helpers in controllers
Yes, I know! Helpers are modules that provide methods which are automatically usable in your view. But sometimes you want to use it in controllers ;) This is my solution. Helpers are available in module named ‘Helpers’, so they don’t brake anything. All rails helpers and named routes are included by default. This is simple usage:5 June 2008