Skip to content

Instantly share code, notes, and snippets.

View radiospiel's full-sized avatar
💭
nothing to see here

eno radiospiel

💭
nothing to see here
View GitHub Profile

Preface

This document contains preliminary information. The final implementation will certainly be different; the purpose of this document is to outline the usage scenario of saved_search objects. This document will be extended to reflect these changes.

1. The SavedSearch model.

looks like this:

#
# The Contract module implements a expect! method, which allows to
# validate data against a set of expectations.
#
# Note that the Contract module should be included whenever you need
# to call <tt>expect!</tt> (or you just call Contract.expect! instead.)
#
# Example:
#
# class MyClass
require "byebug"
class Record < Struct
def self.new(*members, &block)
s = Struct.new(*members, &block)
s.include Initializer
s
end
module Initializer
def Immutable(object)
Immutable.create(object)
end
class Immutable
# turns an object, which can be a hash or array of hashes, arrays, and scalars
# into an object which you can use to access with dot methods.
def self.create(object, max_depth = 5)
case object
when Array
require "mail"
mail = Mail.new do
to 'nicolas@test.lindsaar.net.au'
from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
subject 'First multipart email sent with Mail'
end
text = 'Find my source code attached'
html = 'Find my <b>source code</b> attached'
require "mail"
mail = Mail.new do
to 'nicolas@test.lindsaar.net.au'
from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
subject 'First multipart email sent with Mail'
text_part do
body 'Find my source code attached'
end
require "mail"
mail = Mail.new do
to 'nicolas@test.lindsaar.net.au'
from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
subject 'First multipart email sent with Mail'
text_part do
body 'Find my source code attached'
end
@radiospiel
radiospiel / r.cr
Last active March 16, 2016 14:39
Crystal GC troubles
# r.cr
#
# This results in
#
# ~> crystal r.cr
# GC Warning: Finalization cycle involving 0x10424fe00
#
# No finalizer has been called.
#
class Parent
class X
def a
puts "X::a"
end
end
class Y < X
def a
puts "Y::a"
super
console.log(document.referrer)