Skip to content

Instantly share code, notes, and snippets.

(let ((balance 0)
(root (tap (UIView.)
(.frame= (list '(0 0)
(list (-> *device* .screen .width)
(-> *device* .screen .height))))
(.backgroundColor= (UIColor/whiteColor))))
(balance-label (tap (UILabel.)
(.frame= '((10 10) (80 75)))
(.text= "Balance")))
@dastels
dastels / gist:7847199
Created December 7, 2013 19:12
Specification of frames in iLisp
(describe frame-syntax
(check '{a: 1} '(make-frame a: 1)))
(describe frame-rendering
(check (str (make-frame a: 1)) "{a: 1}"))
(describe naked-symbols
(check a: 'a:))
(describe frame-access
@dastels
dastels / gist:9311961
Created March 2, 2014 19:11
Boggle search
def start
(0...15).each do |start_position|
return true if search(@query,
integer_to_yx(start_position),
[integer_to_yx(start_position)])
end
false
end

Keybase proof

I hereby claim:

  • I am dastels on github.
  • I am dastels (https://keybase.io/dastels) on keybase.
  • I have a public key whose fingerprint is 2A20 D7F0 8D3D 22A6 524D 38D2 5002 6809 F52D 2A21

To claim this, I am signing this object:

describe "Fiddled with Bacon" do
it "supports expect" do
expect(2 + 3).to == 5
end
end
Fiddled with Bacon
- supports expect
@dastels
dastels / expect.rb
Created May 8, 2014 16:27
Add rspec's "expect" syntax to RubyMotion's bacon. Place in your project's spec/helpers/expect.rb
module Bacon
class Context
def expect(obj)
Bacon::Should.new(obj)
end
end
end
@dastels
dastels / gist:cb8c29bc484f7561cb54
Created June 21, 2014 18:21
rubylisp extracted into a freestanding gem
>: irb
2.0.0-p247 :001 > require 'rubylisp'
=> true
2.0.0-p247 :002 > Lisp::Initializer.register_builtins
=> ...
2.0.0-p247 :003 > Lisp::Parser.new.parse('(+ 1 2)').evaluate(Lisp::EnvironmentFrame.global).to_s
=> "3"
@dastels
dastels / gist:f0db88a0b756298d4c59
Created June 21, 2014 19:08
And.... there's a repl.
>: bin/rubylisp
RubyLisp REPL
> 4
4
> (+ 2 3)
5
> (define (fib x) (if (eq? x 0) 1 (* x (fib (- x 1)))))
<function: fib>
> (fib 4)
24
@dastels
dastels / gist:ce800d700677b0b3522b
Created June 29, 2014 16:34
rubymotionlisp demo snippet
(main)> Lisp::Initializer.register_builtins
=> #<Lisp::Primitive:0x9490f50 @name="vector" @doc="" @special=false @implementation=#<Proc:0x9490ef0>>
(main)> p = Lisp::Parser.new
=> #<Lisp::Parser:0x9827330>
(main)> p.parse_and_eval("(+ 2 3)").value
=> 5
@dastels
dastels / gist:0e9d3cf0345bab0f6821
Last active August 29, 2015 14:07
Comparison of NewtonScript and GoLisp
NewtonScript
y := {YMethod: func () print("Y method"),
yVar: 14};
x := {Demo: func () begin
self.newVar := 37;
print(newVar);
self.NewMethod := func () print("hello");
self:NewMethod();
self._parent := y;