Skip to content

Instantly share code, notes, and snippets.

View radarek's full-sized avatar

Radosław Bułat radarek

View GitHub Profile
$ ~/opt/bin/erlc tak.erl
$ ~/opt/bin/erl -noshell -s tak bm -s init stop
1.277981
1.243637
1.241756
1.239656
1.239023
$ ~/opt/bin/erlc +native tak.erl
require "win32ole"
sleep 5
ai = WIN32OLE.new("AutoItX3.Control")
ai.Send("{ENTER}")
*.rbc
*.pyc
$ time ruby1.8.6 pidigits.rb 10000
real 0m33.041s
user 0m30.546s
sys 0m2.076s
$ time jruby --server pidigits.rb 10000 > /dev/null
real 1m25.524s
user 1m23.693s
# vim: ft=ruby
# This file is execute by IRB - Iteractive Ruby
# author: Radosław Bułat
begin
# CORE (should work for all ruby implementation and platforms)
require "rbconfig"
# FEATURE: Color output support
module StringColors
diff --git a/ext/ruby_fann/fann_augment.h b/ext/ruby_fann/fann_augment.h
index a51be4c..2c977c5 100644
--- a/ext/ruby_fann/fann_augment.h
+++ b/ext/ruby_fann/fann_augment.h
@@ -19,9 +19,9 @@ FANN_EXTERNAL struct fann_train_data * FANN_API fann_create_train_from_rb_ary(
unsigned int i, j;
fann_type *data_input, *data_output;
struct fann_train_data *data = (struct fann_train_data *)malloc(sizeof(struct fann_train_data));
- unsigned int num_input = RARRAY(RARRAY(inputs)->ptr[0])->len;
- unsigned int num_output =RARRAY(RARRAY(outputs)->ptr[0])->len;
require "mkmf"
create_makefile("null")
def check() = true
def check2() : Boolean = return true
def check3() = return true // why it can't work?
@radarek
radarek / exception.rb
Created December 19, 2009 14:38 — forked from oki/exception.rb
begin
#raise
#raise Timeout::Error.new('fuckme')
raise ScriptError
rescue Timeout::Error,RuntimeError,ScriptError => e
puts "OK"
end
// How to force IE to invoke "onchange" event after changing radio or checkbox inputs (jQuery example)
$(function () {
if ($.browser.msie) {
$("input:radio, input:checkbox").click(function () {
this.blur();
this.focus();
});
}
});