Skip to content
View jruby_art.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View color_watch.rb
web = %w{#841B2D #c0c0c0 #ffd700}
names = %i{RUBY SILVER GOLD}
colours = names.zip(web).to_h
background color(colours[:GOLD])
View visualizer.rb
# Visualizer
# After http://dry.ly/ruby-music-visualizer by David Guttman
# Load minim and import the packages we'll be using
load_library :minim
import 'ddf.minim'
import 'ddf.minim.analysis'
attr_reader :beat, :current_ffts, :dim, :fft, :freqs, :input
attr_reader :fft_smoothing, :max_ffts, :minim, :scaled_ffts
View classic.rb
# Java::OrgJrubyExceptions::RaiseException
# (ArgumentError) wrong number of arguments calling `initialize` (3 for 0)
# RUBY.mouse_moved(mesh_doodle.rb:62)
attr_reader :prev, :p, :q, :rotation, :faces, :pos, :weight, :renderer
Face = Struct.new(:a, :b, :c)
class Vec3D # re-open the Vec3D class to add rotation functionality
def rotate_y(theta)
View ruby.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bounce.rb
# bounce.rb
class Bounce < Processing::App
BLUE = '#0000FF'
GREEN = '#00FF00'
RED = '#FF0000'
WHITE = '#FFFFFF'
BALL_SPEED = 5
BALL_SIZE = 32
View extensions.xml
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-ruby</artifactId>
<version>0.1.11</version>
</extension>
</extensions>
View steinberg.glsl
// Original shader by RavenWorks
// Fake Floyd-Steinberg dithering
// https://www.shadertoy.com/view/4sjGRD
// Adapted for Ruby-Processing by Martin Prout <@monkstoneT>
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
View custom_array.rb
require 'forwardable'
# A custom Array created using forwardable (that can also access the PApplet pre,
# post and draw loops by extending our new LibraryProxy class. Also has access
# to custom background(int), fill(int) and stroke(int) methods.
class CustomArray < LibraryProxy
extend Forwardable
def_delegators(:@objs, :each, :<<)
include Enumerable
View convert.rb
# convert.rb
def titleize(str)
str.gsub(/::/, '/')
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.tr('-', '_')
.downcase
.gsub(/_id$/, '')
.gsub(/_/, ' ').capitalize
Something went wrong with that request. Please try again.