This file contains hidden or 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
| 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 |
This file contains hidden or 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
| require 'bacon' | |
| Bacon.summary_on_exit | |
| Bacon.extend Bacon::TestUnitOutput | |
| require 'strscan' | |
| module Bacon | |
| class Story | |
| attr_reader :text, :scenarios, :scanner, :indent, :name, :matches |
This file contains hidden or 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
| require 'ffi' | |
| module SysInfo | |
| extend FFI::Library | |
| ffi_lib [FFI::Library::LIBC] | |
| class IfAddrs < FFI::Struct | |
| layout( | |
| :ifa_next, :pointer, | |
| :ifa_name, :pointer, |
This file contains hidden or 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
| 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 } |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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) |
This file contains hidden or 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
| module NaquaDSL | |
| class << self | |
| options = { | |
| :pages => 2, | |
| :cookie_file => './cookies.txt' | |
| } | |
| feeds = {} | |
| define_method :set do |*args| |