Skip to content

Instantly share code, notes, and snippets.

let p = function
| `Int i -> print_endline (string_of_int i)
| `Float f -> print_endline (string_of_float f)
| `String s -> print_endline s
;;
let upper = 42 in
let lower = -upper in
let x = 0 in
let y = 0 in
require 'bacon'
Bacon.summary_on_exit
Bacon.extend Bacon::TestUnitOutput
require 'strscan'
module Bacon
class Story
attr_reader :text, :scenarios, :scanner, :indent, :name, :matches
require 'ffi'
module SysInfo
extend FFI::Library
ffi_lib [FFI::Library::LIBC]
class IfAddrs < FFI::Struct
layout(
:ifa_next, :pointer,
:ifa_name, :pointer,
require 'ffi-tk'
root = Tk::Root.new
var = Tk::Variable.new('RubyFFI::foo')
entry = Tk::Tile::Entry.new(root, textvariable: var)
entry.pack
entry.focus
show = proc{ p var }
class Etanni
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
CHOMP = "<<#{SEPARATOR}.chomp!"
START = "\n_out_ << #{CHOMP}\n"
STOP = "\n#{SEPARATOR}\n"
REPLACEMENT = "#{STOP}\\1#{START}"
def initialize(template, filename = '<Etanni>')
@template = template
@filename = filename
class Etanni
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
CHOMP = "<<#{SEPARATOR}.chomp!"
START = "\n_out_ << #{CHOMP}\n"
STOP = "\n#{SEPARATOR}\n"
REPLACEMENT = "#{STOP}\\1#{START}"
def initialize(template, filename = '<Etanni>')
@template = template
@filename = filename
class Etanni
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
CHOMP = "<<#{SEPARATOR}.chomp!"
START = "\n_out_ << #{CHOMP}\n"
STOP = "\n#{SEPARATOR}\n"
REPLACEMENT = "#{STOP}\\1#{START}"
def initialize(template, filename = '<Etanni>')
@template = template
@filename = filename
class Etanni
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
CHOMP = "<<#{SEPARATOR}.chomp!"
START = "\n_out_ << #{CHOMP}\n"
STOP = "\n#{SEPARATOR}\n"
REPLACEMENT = "#{STOP}\\1#{START}"
def initialize(template, filename = '<Etanni>')
@template = template
@filename = filename
class Neuron
attr_accessor :learning_rate, :weights, :last_activation
def initialize(learning_rate, num_inputs)
self.learning_rate = learning_rate
self.weights = Array.new(num_inputs){ rand }
self.last_activation = 0
end
def forward_propagation(data)
module NaquaDSL
class << self
options = {
:pages => 2,
:cookie_file => './cookies.txt'
}
feeds = {}
define_method :set do |*args|