Skip to content

Instantly share code, notes, and snippets.

View pachun's full-sized avatar

Nicholas Pachulski pachun

View GitHub Profile
window.onload = function() {
var command;
var colors = ['#b89a7b', '#9bbaac'];
// setup the websocket
var socket = new WebSocket('ws://localhost:8888/chatsocket');
socket.onmessage = function(e) {
console.log(e.data);
class ConsoleCanvas < Array
def height; self.size; end
def width; self[0].size; end
def initialize(w,h)
super(h){Array.new(w,' ')}; system 'stty -icanon -echoke'
end
def set(x,y,v)
self[y.to_i][x.to_i]=v if (0...width).include?(x) && (0...height).include?(y)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = ConstraintScreen.new
@window.makeKeyAndVisible
true
end
end
class ConstraintScreen < UIViewController
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = ConstraintScreen.new
@window.makeKeyAndVisible
true
end
end
class ConstraintScreen < UITableViewController
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = TableViewController.new
@window.makeKeyAndVisible
end
end
class TableViewController < UITableViewController
stylesheet :main
def load_incoming_ticket_data
Location.boston do |location|
location.find_ticket(@incoming_ticket_number) do |ticket|
LocalTicket.persist ticket
alert = BW::UIAlertView.default(
title: "Ticket #{ticket_id} is ready to be paid",
buttons: ["Pay later", "Pay now!"]
) do |alert2|
if alert2.clicked_button.index == 1
left_menu_view_controller.show_ticket ticket
@pachun
pachun / gist:6133504
Created August 1, 2013 17:33
The longest cocoa method name. Holy shit.
- (id)initWithBitmapDataPlanes:(unsigned char **)planes
pixelsWide:(NSInteger)width
pixelsHigh:(NSInteger)height
bitsPerSample:(NSInteger)bps
samplesPerPixel:(NSInteger)spp
hasAlpha:(BOOL)alpha
isPlanar:(BOOL)isPlanar
colorSpaceName:(NSString *)colorSpaceName
bitmapFormat:(NSBitmapFormat)bitmapFormat
bytesPerRow:(NSInteger)rowBytes
Create ./build/iPhoneOS-6.1-Development/TicketZen.dSYM
Codesign ./build/iPhoneOS-6.1-Development/TicketZen.app
Create ./build/iPhoneOS-6.1-Development/TicketZen.ipa
Deploy ./build/iPhoneOS-6.1-Development/TicketZen.ipa
rake aborted!
undefined method `[]' for nil:NilClass
/Library/RubyMotion/lib/motion/project/template/ios/config.rb:107:in `read_provisioned_profile_array'
/Library/RubyMotion/lib/motion/project/template/ios/config.rb:112:in `provisioned_devices'
/Library/RubyMotion/lib/motion/project/template/ios.rb:161:in `block in <top (required)>'
/Users/pachun/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
@pachun
pachun / gist:6429227
Created September 3, 2013 20:37
Formotion & ProMotion
class AppDelegate < PM::Delegate
def on_load(app, options)
open GreenScreen.new(nav_bar: true)
end
end
class GreenScreen < ProMotion::Screen
attr_accessor :one_section_button, :two_section_button
title 'Green'
@pachun
pachun / gist:6800237
Last active December 24, 2015 12:49
class TrioTracker
def initialize
draw_window
add_header
end
def draw_window
Shoes.app(width:1280, height:800, title:'Trio Tracker')
end