Skip to content

Instantly share code, notes, and snippets.

View GantMan's full-sized avatar
🤖
Being a Machine Learning beast

Gant Laborde GantMan

🤖
Being a Machine Learning beast
View GitHub Profile
@GantMan
GantMan / family_connect_cell.rb
Last active August 29, 2015 13:57
rmq_build checking this out
class FamilyConnectCell < 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)
@GantMan
GantMan / new.rb
Last active August 29, 2015 13:58
RMQ switching from Default to Subtitle Table Cell
def tableView(table_view, cellForRowAtIndexPath: index_path)
data_row = @data[index_path.row]
#cell = table_view.dequeueReusableCellWithIdentifier(ALERTS_CELL_ID) || begin
# rmq.create(AlertsCell, :alerts_cell, reuse_identifier: ALERTS_CELL_ID).get
#end
cell ||= AlertsCell.alloc.initWithStyle(UITableViewCellStyleSubtitle, reuseIdentifier:ALERTS_CELL_ID).autorelease
cell = rmq.build(cell, :alerts_cell).get
@GantMan
GantMan / example.rb
Created July 1, 2014 15:52
Validation use Example
# Validation Growth Plan
# STEP 1: Validation Tool/Utility
# STEP 2: Check on Validity of RMQ selected
# STEP 3?: Place validation on a specific input, that will watch and validate onchange
# The following a is a suggested workflow for Step 2
# Example project validation method
require 'date'
require 'koala'
class BirthdayLiker
FACEBOOK_TOKEN = 'your_oauth_key'
BIRTHDAY_WORDS = %w(birthday bday birfday birth born hbd)
THANKS_OPTIONS = ['Thank you!', 'Thanks!', 'Appreciate it!', 'Danke!', ':)']
DATE_TIME_FORMAT = '%Y-%m-%d'
def initialize(birthdate, opts={})
class MainActivity < Android::App::Activity
def onCreate(savedInstanceState)
super
seekBar = Android::Widget::SeekBar.new(self)
seekBar.setMax(200)
seekBar.setProgress(100)
textView = Android::Widget::TextView.new(self)
@GantMan
GantMan / nasty_hack.rb
Created September 15, 2014 20:18
collapse table section when no data
# requires earlier use of self.tableView.sectionHeaderHeight = 0
# + this
def tableView(table_view, heightForHeaderInSection:section)
# nasty hack to hide empty section
if @data[section].empty?
0
elsif @data[section - 1].empty? #squeeze follow up section
20
else
def purchase_single_product(identifier)
NSLog "Starting purchase process for #{identifier}."
@iap_helper = IAPHelper.new(NSSet.setWithArray([identifier]))
@iap_helper.cancelled = cancelled_transaction
@iap_helper.success = transaction_successful
@iap_helper.request_product_info do |success, products|
if success && products.is_a?(Array) && products.count == 1
@iap_helper.buy_product(products.first)
else
@GantMan
GantMan / base_64.rb
Created October 30, 2014 19:44
RubyMotion 64bit encode/decode
# ~~ ENCODING TO Base64 ~~ #
start = "This is a test".dataUsingEncoding(NSUTF8StringEncoding)
#=> This is a test
encoded = start.base64EncodedStringWithOptions(0)
#=> "VGhpcyBpcyBhIHRlc3Q="
@GantMan
GantMan / main_activity.rb
Last active August 29, 2015 14:18
Webview Check
class MainActivity < Android::App::Activity
attr_reader :webview
def onCreate(savedInstanceState)
super
@webview = Android::Webkit::WebView.new(self)
settings = @webview.settings
settings.savePassword = true
settings.saveFormData = true
@GantMan
GantMan / class.rb
Created April 29, 2015 13:27
This is an excellent example, if I say so, myself.
def gant
puts "Gant is awesome"
end