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 / 20120502152724_add_vermin_to_buffet.rb
Created May 2, 2012 15:54
Iconoclast Labs Migration Blog Command Examples
class AddVerminToBuffet < ActiveRecord::Migration
def change
add_column :buffets, :vermin, :boolean, default: true
end
end
def draw_feature(context, atPoint:feature_point)
size = 6
startx = feature_point.x - (size/2)
starty = feature_point.y - (size/2)
CGContextAddRect(context, [[startx, starty], [size, size]])
CGContextDrawPath(context, KCGPathFillStroke)
end
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = RootController.alloc.init
#Splash Screen
image_view = UIImageView.alloc.initWithImage(UIImage.imageNamed("Default.png"))
@window.rootViewController.view.addSubview(image_view)
@window.rootViewController.view.bringSubviewToFront(image_view)
# normal
@window.makeKeyAndVisible
1 class Appetizer < ActiveRecord::Base
2 include ActiveModel::ForbiddenAttributesProtection
3 end
@GantMan
GantMan / root_controller.rb
Created April 24, 2013 20:11
Mixing Awesome-Motion with Teacup and other insanity for Blog post. http://iconoclastlabs.com/cms/blog/posts/motion-awesome-amazing-icons-in-your-app
class RootController < UIViewController
include MotionAwesome
def layoutDidLoad
# Custom Navigation Title
@mine = label( :beer, text: "Get Crunk" ) do |label|
label.backgroundColor = UIColor.clearColor
label.sizeToFit
self.navigationItem.titleView = label
end
@GantMan
GantMan / sample_code.rb
Last active December 16, 2015 20:38
code to show async grab using Bubblewrap
class SampleCode
attr_accessor :lines
DOMAIN = "www.yourdomain.com"
def next_line
if @lines.blank?
#refurnish
@lines = App::Persistence['quips'].dup
@lines.shuffle!
end
@GantMan
GantMan / 6524OT_01_04.rb
Last active December 18, 2015 22:39
Code Gists from the Book
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
true
end
end
@GantMan
GantMan / current_routes.rb
Created July 17, 2013 17:57
Showing idea of the
resources :coordinator_groups do
resources :events do
resources :teams
end
end
@GantMan
GantMan / Rakefile
Last active December 20, 2015 04:28
Accompanying code for my SocialFramework in RubyMotion blog
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'SocialFramework'
# Old way was to include the Twitter framework here
app.frameworks += ["Social", "Accounts"]
end