View coroutine_scheduler.lua
pcall(require,"socket")
local coroutine_scheduler = {
_NAME = "coroutine_scheduler.lua"
_VERSION = "1.0.0",
}
local Scheduler
do Scheduler = setmetatable({}, {
__call = function(class)
View gist:5a56ad8f23f1ebff93a03896dae53cef
require 'tk'
class Pendulum
def initialize
setup
show
@after_id = @root.after(500) {animate}
@canvas.bind('<Destroy>') do
@root.after_cancel(@after_id)
View popup.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'tk'
require 'pp'
class TkWindow_Main
def initialize()
@root = TkRoot.new {
title 'Root'
View tkwindow_observer.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'tk'
require 'observer'
class TkWindow_Main
def initialize()
@root = TkRoot.new {
title 'Root'
View gist:e161b687627816c6951982694343ea37
require 'ffi'
module Foo
extend FFI::Library
ffi_lib 'ruby-1.9.1'
attach_function :rb_intern, [:string], :long
attach_function :rb_obj_id, [:long], :long
attach_function :rb_funcall2, [:long, :long, :int, :pointer], :long
end
View iseq.rb
require 'ffi'
module RB
extend FFI::Library
ffi_lib [:ruby]
attach_function :iseq_load, :rb_iseq_load, [:pointer, :int, :pointer], :pointer
attach_function :iseq_eval, :rb_iseq_eval, [:pointer], :pointer
attach_function :eval_string, :rb_eval_string, [:string], :pointer
View binding_of_caller-ffi.rb
#!/usr/bin/env ruby
# =============================================================================
# Quick proof-of-concept of an FFI-based binding_of_caller (no compiling!)
#
# Author: Steve Shreeve <steve.shreeve@gmail.com>
# Basis: binding_of_caller and ffi gems
# Date: 28 May 2015
#
# Legal: MIT License
View fficlangtest.rb
# Getting LLVM :
# http://llvm.org/releases/download.html#3.4
# Usage example :
# $ LLVM_CONFIG=~/Downloads/clang+llvm-3.4-x86_64-apple-darwin10.9/bin/llvm-config ruby fficlangtest.rb /usr/include/stdio.h
require 'ffi/clang'
index = FFI::Clang::Index.new
translation_unit = index.parse_translation_unit(ARGV[0])
cursor = translation_unit.cursor
cursor.visit_children do |cursor, parent|
View ffi-ruby.rb
require 'ffi'
module FFI::Ruby
class Value
class << self
extend ::FFI::Library
ffi_lib 'ruby'
attach_function :rb_obj_id, [:pointer], :pointer
attach_function :rb_num2long, [:pointer], :long
View ffi6.rb
require 'ffi'
module RubyInternals
extend FFI::Library
ffi_lib(FFI::CURRENT_PROCESS)
attach_variable :ptr_vm_core, :rb_mRubyVMFrozenCore, :pointer
attach_function :const_def_pointer, :rb_define_const,
[:pointer, :string, :pointer], :void