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:
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 |
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project/template/ios' | |
require './lib/preprocessor' | |
begin | |
require 'bundler' | |
Bundler.require | |
rescue LoadError | |
end |
I hereby claim:
To claim this, I am signing this object:
# 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 |
RESULTS
Rake::TestTask
time rake test
real 0m1.111s
user 0m0.962s
sys 0m0.133s
time rake test
#!/usr/bin/ruby | |
puts ARGV.sample |
class OpenStruct < BasicObject | |
def initialize(hash) | |
@struct = ::Struct.new(*hash.keys.map { |k| k.to_sym }) | |
@struct = @struct.new(*hash.values) | |
end | |
def ==(other) | |
to_h == other.to_h | |
end |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) | |
{ | |
char hello[80]; | |
strcpy(hello, "Hello "); | |
if (argc > 1) | |
{ | |
puts(strcat(hello, argv[1])); |
class ProfileLayout < MotionKit::Layout | |
def layout | |
add UIImageView, :profile_image | |
add UILabel, :name_label | |
add UILabel, :bio_label | |
background_color UIColor.whiteColor | |
end | |
def profile_image_style |
While working on the iOS Development with Swift book I decided on this code for an example I'm using in the chapter that talks about composing views together. This is a silly little scroll view that displays a user's bio, and is actually used by a ProfileView
that contains this and a UserDetailsView
.
On line 19 I'm creating the setter for the text
property that basically is meant to act as a way to apply default attributes to a plain string and assign it to the bio label's attributedText
property.