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
(defun plexus-lisp-init () | |
(rainbow-delimiters-mode) | |
(auto-complete-mode)) | |
(add-hook 'emacs-lisp-mode-hook 'plexus-lisp-init) | |
(add-hook 'cider-mode-hook 'plexus-lisp-init) | |
(add-hook 'cider-repl-mode-hook 'plexus-lisp-init) | |
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) |
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
module Hexp | |
# Transparently use Hexp nodes in templates | |
class Node | |
def to_s | |
to_html.html_safe | |
end | |
end | |
# Honor ActiveSupport::SafeBuffer's "html_safe" flag | |
class Unparser |
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
%w[yaks morpher ast].each do |lib| | |
$:.unshift("/home/arne/github/#{lib}/lib") | |
$:.unshift("/home/arne/github/#{lib}/#{lib}/lib") | |
require lib | |
end | |
require 'pp' | |
r=Yaks::Resource.new( | |
attributes: {name: "Plain grass", type: "grass"}, |
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
#!/usr/bin/ruby | |
require 'socket' | |
require 'thread' | |
require 'optparse' | |
require 'tmpdir' | |
class ProxyServer | |
attr_reader :switches | |
attr_reader :listen_port, :remote_host, :remote_port |
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
#!/usr/bin/ruby | |
require 'socket' | |
require 'thread' | |
require 'optparse' | |
require 'tmpdir' | |
class ProxyServer | |
attr_reader :switches | |
attr_reader :listen_port, :remote_host, :remote_port |
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
module Yaks | |
# State monad-ish thing. | |
class StatefulBuilder < BasicObject | |
def create(*args, &block) | |
@state = @klass.create(*args) | |
instance_eval(&block) | |
@state | |
end | |
def initialize(klass, methods) |
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
module Yaks | |
# State monad-ish thing. | |
class StatefulBuilder < BasicObject | |
def create(*args, &block) | |
@state = @klass.create(*args) | |
instance_eval(&block) | |
@state | |
end | |
class StatefulMethods < ::Module |
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
module Yaks | |
# State monad-ish thing. | |
class StatefulBuilder < BasicObject | |
def create(*args, &block) | |
@state = @klass.create(*args) | |
instance_eval(&block) | |
@state | |
end | |
def initialize(klass, methods) |
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
module Yaks | |
# State monad-ish thing. | |
# | |
# Generate a DSL syntax for immutable classes. | |
# | |
# @example | |
# | |
# # This code | |
# Control.create(:search) | |
# .method("POST") |
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
class Module | |
def ===(object) | |
object.kind_of?(self) | |
end | |
end | |
class Foo < BasicObject | |
def x | |
3 | |
end |