View rpk.rb
module Rpk
module Win32
class API
def self.setup
require 'fiddle/import'
const_set(:DLL, {}) unless defined? DLL
View heap_info.rb
require 'json'
require 'fiddle'
module HeapUtils
SIZEOF_HEAP_PAGE_HEADER_STRUCT = Fiddle::SIZEOF_VOIDP
HEAP_PAGE_ALIGN_LOG = 14
HEAP_PAGE_ALIGN = 1 << HEAP_PAGE_ALIGN_LOG
HEAP_PAGE_ALIGN_MASK = ~(~0 << HEAP_PAGE_ALIGN_LOG)
# SIZEOF_RVALUE = 56 # Only when GC_DEBUG is enabled
View chicken.rb
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
View plist.rb
require 'fiddle'
module CoreFoundation
CFTypeRef = Fiddle::TYPE_VOIDP
CFTypeRefPointer = Fiddle::TYPE_VOIDP
SInt32Pointer = Fiddle::TYPE_VOIDP
UInt8Pointer = Fiddle::TYPE_VOIDP
CFIndex = Fiddle::TYPE_LONG
CFTypeID = -Fiddle::TYPE_LONG
View bluetooth_scan.rb
#!/usr/bin/env ruby
require 'fiddle/import'
require 'fiddle/types'
LIBBT = '/usr/lib/libbluetooth.so.3'
LIBC = '/usr/lib/libc.so.6'
module Bluetooth
extend Fiddle::Importer
View class_reference.rb
def main
loop do
name = choise(class_list, combine: true)
clear
puts Module.const_get(name).info
puts
choise(["戻る"])
clear
View github_download.rb
def bget(url, token)
if token
ret = Browser.get(url, header: { "Authorization" => "token #{token}"})
else
ret = Browser.get(url)
end
JSON::parse(ret)
end
View matching-and-dynamic-schemas.rb
require "rspec"
require "json"
require "dry-types"
require "dry-validation"
module Types
include Dry::Types.module
RegionCode = Types::Strict::String.constrained(
format: /\A(au|nz|uk|ie)\z/,
View rom-http-repo-aggregate.rb
require 'bundler/inline'
require 'json'
require 'uri'
require 'net/http'
gemfile(true) do
gem 'inflecto'
gem 'rom', github: 'rom-rb/rom'
gem 'rom-support', github: 'rom-rb/rom-support'
gem 'rom-http', github: 'rom-rb/rom-http'
View dry_v_either_filled.rb
require 'dry-validation'
schema = Dry::Validation.Schema do
configure do
def self.messages
super.merge(en: { errors: { foo: 'either a or b can be filled' } })
end
end
required(:a).maybe