Skip to content

Instantly share code, notes, and snippets.

class CategoryCell < UITableViewCell
def rmq_build
rmq(self.contentView).tap do |q|
# Add your subviews, init stuff here
# @foo = q.append(UILabel, :foo).get
#
# Or use the built-in table cell controls, if you don't use
# these, they won't exist at runtime
# q.build(self.imageView, :cell_image)
class ItemCell < UITableViewCell
def rmq_build
rmq(self.contentView).tap do |q|
# Add your subviews, init stuff here
# @foo = q.append(UILabel, :foo).get
#
# Or use the built-in table cell controls, if you don't use
# these, they won't exist at runtime
# q.build(self.imageView, :cell_image)
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
initAFNetworkingClient
Colors.fetch(AFMotion::Client) do |data|
main_controller = ColorController.alloc.initWithData(data)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(main_controller)
@window.rootViewController.navigationBar.barTintColor = '#DF533B'.to_color
@window.rootViewController.navigationBar.translucent = true
@window.rootViewController.navigationBar.tintColor = UIColor.whiteColor
@window.rootViewController.navigationBar.setTitleTextAttributes({
module Formotion
module RowType
class QuoteRow < StringRow
def add_callbacks(field)
super
field.should_change? do |field, range, new_string|
newlength = field.text.length + new_string.length - range.length
if newlength > 34
false
else
class MyController < UIViewController
....
def viewDidLoad
@note_table = rmq(self.view).append(UITableView, :top_stylesheet).get
@note_table_delegate = NoteTableDelegate.new
@note_table.delegate = @note_table_delegate
@note_table.dataSource = @note_table_delegate
@note_table.separatorColor = UIColor.clearColor
end
...
class NotesCell < UITableViewCell
def rmq_build
rmq(self.contentView).tap do |q|
@note = q.append(UILabel, :note_label).get
end
end
def update(data)
@note.text = data[:note]
@note.lineBreakMode = UILineBreakModeWordWrap
activity_vc = UIActivityViewController.alloc.initWithActivityItems(["Hey! I thought you might like \"#{item_name}\" \n\nCheck it out here: ", NSURL.URLWithString("http://myqirc.com/?rec="+encoded_rec)], applicationActivities:nil)
activity_vc.setValue(item_name, forKey: 'subject')
item = "Jalapeño" #does not work - gives BAD URL error
item = "Jalapeno" #does work
client.shared.get("myapi/#{item}") do |result|
if result.success?
block.call(result.object)
else
puts result.error.to_s
end
end
@Omnipresent
Omnipresent / Foo.java
Last active August 29, 2015 14:24
How can values in a JS array be populated from a Java method returning a list?
//getters of java class
//returns [0] = "something, -33.89, 151.2" [1] = "beach, -33.9, 15.02" etc.
public List<String> getVals() {
return vals;
}
public String getGoogleClass() {
if (vals.size() == 0)
return "";
<div id="map_wrapper">
<div data-sly-use.ev="Evernote"
class="mapping"
title="${ev.title || ''}"
data-emptytext="Evernote Asset"
id="${ev.googleClass || ''}"
>
</div>
</div>