This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Spin up a new Ruby VM, start Ruby-Processing in it. | |
private void spinUp(String command, String path) { | |
final RubyInstanceConfig config = new RubyInstanceConfig() {{ | |
setLoader(this.getClass().getClassLoader()); | |
}}; | |
if (_ruby != null) _ruby.tearDown(); | |
_ruby = Ruby.newInstance(config); | |
_ruby.evalScriptlet("RP5_EMBEDDED = true; ARGV[0] = '" + path + "'; require 'ruby-processing/lib/ruby-processing/runners/" + command + ".rb'"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change: | |
import “processing.core” | |
# to this: | |
include_package “processing.core” | |
raise “hell” unless defined? Java::ProcessingCore::PApplet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change: | |
import "processing.core" | |
# to this: | |
include_package "processing.core" | |
raise "hell" unless defined? Java::ProcessingCore::PApplet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: If you've been using VMWare recently, it leaves some network | |
# services dangling. Kill the before you start the sketch: | |
# sudo killall vmnet-netifup | |
load_library 'carnivore' | |
require 'packet_listener' | |
include Java::PacketListener | |
def setup | |
@nodes = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load_library 'pdf' | |
import 'processing.pdf' | |
def setup | |
begin_record PDF, "/path/to/file.pdf" | |
end | |
def draw | |
# Insert code here. | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load_library 'video' | |
import 'processing.video.MovieMaker' | |
def setup | |
size 300, 150 | |
@mm = MovieMaker.new(self, width, height, "drawing.mov") | |
background 20, 20, 100 | |
fill 147, 246, 258, 20 | |
smooth | |
no_stroke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move the mouse left and right to change the field of view (fov). | |
# Click to modify the aspect ratio. The perspective method | |
# sets a perspective projection applying foreshortening, making | |
# distant objects appear smaller than closer ones. The parameters | |
# define a viewing volume with the shape of truncated pyramid. | |
# Objects near to the front of the volume appear their actual size, | |
# while farther objects appear smaller. This projection simulates | |
# the perspective of the world more accurately than orthographic projection. | |
# The version of perspective without parameters sets the default | |
# perspective and the version with four parameters allows the programmer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shttpd = net.http.server.shttpd | |
var Server = shttpd.Server; | |
var httpd = new Server(8080); | |
print ("Starting server on port 8080") | |
httpd.registerURI( | |
"/", | |
function (request) { | |
request.print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"); | |
request.print("<html><body>Hello, v8 world</body></html>"); | |
request.setFlags(shttpd.END_OF_OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This method will be called on any create or update, and should be the central | |
# clearing house for data processing and conversion. | |
def request_update_attributes(data, user=User.current, instance_id=ZenbeInstance.current) | |
instance_id ||= 'NO_INSTANCE_ID' | |
return false unless self.accessible_to?(user) | |
self.process_files(data) | |
self.process_embedded_urls(data) | |
self.update_attributes(data) | |
self.set_post_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("The array [1,2,3]", function() { | |
before(function() { | |
ary = [1,2,3]; | |
}); | |
should('not be empty', function() { | |
ary.length.should().not().be(0); | |
ary.indexOf(1).should().be(0); | |
}); |