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
@radiospiel
radiospiel / localpod.mdown
Created March 9, 2012 22:41
How I use Cocoapod locally
  1. Preparation

Setup a local CocoaPods directory, and register it with CocoaPods

mkdir -p ~/CocoaPods/Local
(cd ~/CocoaPods/Local; git init)
pod repo add ~/CocoaPods/Local
  1. Update local CocoaPod
@radiospiel
radiospiel / update-localpod
Created March 9, 2012 22:39
File to update local CocoaPod
#!/usr/bin/env ruby
require "fileutils"
SCRIPT = File.basename(__FILE__)
DIR = File.expand_path File.dirname(__FILE__)
LOCAL_PODS = File.expand_path "~/CocoaPods/Local"
HEAD = `git log -1 --pretty=%H`.chomp
def git(*args)

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