Skip to content

Instantly share code, notes, and snippets.

View jacklynrose's full-sized avatar

Jacklyn Rose jacklynrose

  • Australia
View GitHub Profile
@jacklynrose
jacklynrose / post_rest_store.rb
Created February 16, 2014 14:05
RestKit Wrapper Usage Proposal
class PostRestStore < RestfulMotion::Store
api_endpoint 'http://example.com/v2/posts'
model :post
# some attribute mapping code
end
@jacklynrose
jacklynrose / app_delegate.rb
Created March 5, 2014 11:36
SUPER basic clone of RMQ's stylesheet and selectors (no symbol based selection or fancy stylers, and other missing functionality like chaining)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = MyViewController.new
@window.makeKeyAndVisible
true
end
end
@jacklynrose
jacklynrose / RubyMotionTheRailsWay.md
Last active August 29, 2015 13:57
Ideas on how to write RubyMotion apps the "Rails" way

RubyMotion The "Rails" Way

This is a current proposal that I'd like your feedback on for how we can clean up how we write RubyMotion applications. It's purely conceptual at the moment, and there would have to be some framework development to make this work the way described here.

Please submit your feedback, as a joint effort we can clean up our RubyMotion applications and make it easier for Rails developers to expand their skills into RubyMotion development.

Goals

The main points of this are:

@jacklynrose
jacklynrose / rubymotion_method_definition_benchmarks.md
Created March 11, 2014 01:07
RubyMotion Method Definition Benchmarks

Method definition benchmarks for different versions

Using Ken Miller's benchmarking app: https://github.com/kemiller/rubymotion_benchmarking

2.20 - Take 1

                                            ObjC native loop:        0.001162
                             ObjC native loop w/objc_msgSend:        0.001512
                          ObjC method called from ruby (raw):        0.028951
@jacklynrose
jacklynrose / uiview+controller_helper.rb
Created March 16, 2014 14:45
Monkey patch for finding the controller of a view
class UIView
def controller
if self.nextResponder.is_a? UIViewController
return self.nextResponder
elsif self.nextResponder.respond_to? :controller
return self.nextResponder.controller
end
end
end
@jacklynrose
jacklynrose / Rakefile
Last active August 29, 2015 13:57
Simple macro like functionality for RubyMotion
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require './lib/preprocessor'
begin
require 'bundler'
Bundler.require
rescue LoadError
end
@jacklynrose
jacklynrose / keybase.md
Created April 16, 2014 23:55
keybase.md

Keybase proof

I hereby claim:

  • I am fluffyjack on github.
  • I am fluffyjack (https://keybase.io/fluffyjack) on keybase.
  • I have a public key whose fingerprint is 8203 E7C0 359A 6B05 1787 ED6E C1C5 3A42 6E34 5928

To claim this, I am signing this object:

@jacklynrose
jacklynrose / fib_calculator.rb
Created April 19, 2014 11:13
Fast and memory efficient fib calculation based off Ray Hightower's memoization method but with better memory usage (http://rayhightower.com/blog/2014/04/12/recursion-and-memoization/)
# Fibonacci numbers WITH memoization.
# Initialize the memoization hash.
@scratchpad = {}
@max_fibo_size = 1_000_000_000_000
# Calculate the nth Fibonacci number, f(n).
def fibo (n)
val = if n <= 1
n
@jacklynrose
jacklynrose / README.md
Last active August 29, 2015 14:01
How I run MiniTest tests in 50% of the time of Rake::TestTask

RESULTS

Rake::TestTask

time rake test
real	0m1.111s
user	0m0.962s
sys	0m0.133s

time rake test
@jacklynrose
jacklynrose / chooser.rb
Created May 13, 2014 07:46
How my girlfriend and I can make decisions from now on
#!/usr/bin/ruby
puts ARGV.sample