This is a simple TextMate command that allows you to preview the current document you're editing right on Marked editor.
1.upto(100) do |i| | |
puts ''.tap {|output| | |
output << 'Fizz' if i.modulo(3).zero? | |
output << 'Buzz' if i.modulo(5).zero? | |
output << i.to_s if output.empty? | |
} | |
end |
#!/usr/bin/env macruby -wKU | |
framework 'Foundation' | |
module Dispatch | |
module Futuristic | |
def proxy | |
Class.new(BasicObject) do | |
def initialize(obj) | |
@obj = obj | |
end |
## RubyMotion | |
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1) | |
encodedData = [imageData].pack("m0") | |
data["image"] = encodedData | |
BW::HTTP.post("http://localhost:3000/upload}", {payload: data}) do |response| | |
if response.ok? | |
end | |
end |
# code inspired from http://jainmarket.blogspot.com/2009/05/creating-custom-table-view-cell.html | |
class CustomCell < UITableViewCell | |
attr_accessor :primaryLabel | |
attr_accessor :secondaryLabel | |
def createLabels | |
@primaryLabel = UILabel.alloc.init |
require 'socket' | |
def local_ip | |
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily | |
UDPSocket.open do |s| | |
s.connect '64.233.187.99', 1 | |
s.addr.last | |
end | |
ensure | |
Socket.do_not_reverse_lookup = orig |
#!/usr/bin/env ruby | |
# take photo after commit ; ) | |
file="~/.gitshots/#{Time.now.to_i}.jpg" | |
puts "Taking capture into #{file}!" | |
system "imagesnap -q -w 3 #{file}" | |
exit 0 |
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project' | |
# custom rake tasks | |
require '../raketasks/gemerator.rb' | |
desc "Open latest crash log" | |
task :log do | |
app = Motion::Project::App.config |
For the last two weeks I've been working flat out with Rubymotion, a new toolchain that allows developers to build native iOS applications using the beautiful, elegant Ruby programming language instead of the verbose and somewhat fussy Objective-C programming language.
The app I've been working on is an existing client app we've been developing for several months. The app was about 80% ready for a pilot launch but still had quite a bit of development to go before being shipped. After discussing Rubymotion with the client, we agreed that it would save us both time and money in future development if we move over to Rubymotion. I was tasked with doing the migration; transposing the entire application to Rubymotion.
For those of you looking to do the same, here are some stats that might help you estimate the time required and the costs
This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:
- Hulu / HuluPlus
- CBS
- ABC
- MTV
- theWB
- CW TV
- Crackle
- NBC