Skip to content

Instantly share code, notes, and snippets.

💭
nothing to see here

eno radiospiel

💭
nothing to see here
Block or report user

Report or block radiospiel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View saved_search.md

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:

View contract.rb
#
# 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
View record.rb
require "byebug"
class Record < Struct
def self.new(*members, &block)
s = Struct.new(*members, &block)
s.include Initializer
s
end
module Initializer
View immutable.rb
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
View mt.rb
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'
View mt.rb
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
View mt.rb
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 Mar 16, 2016
Crystal GC troubles
View r.cr
# r.cr
#
# This results in
#
# ~> crystal r.cr
# GC Warning: Finalization cycle involving 0x10424fe00
#
# No finalizer has been called.
#
class Parent
View gist:1995f5b1d9630444b241
class X
def a
puts "X::a"
end
end
class Y < X
def a
puts "Y::a"
super
You can’t perform that action at this time.