Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Bodacious / my_controller.rb
Created March 14, 2012 20:19
Responding to a JSON PUT/DELETE request with JSON
class MyController < ApplicationController
def update
if resource.update_attributes(params[:resource])
render json: resource, status: :ok # status is :ok by default so feel free to remove this option
else
render json: { errors: resource.errors }, status: :unprocessable_entity
end
end
@Bodacious
Bodacious / Explanation.md
Created May 11, 2012 08:53
RubyMotion method name explanation...

RubyMotion comes with some syntax idioms that are not strictly idiomatic Ruby.

For example, in an iOS app we'd often see these two methods defined in a subclass of UITableViewController

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
      // callback code for selecting table rows goes here...
@Bodacious
Bodacious / id_rsa.pub
Created May 15, 2012 08:41
My Macbook Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN+R6PtOsWqdznRlZwFaV2NYw3FNFqnfbiCZYTKCgt0U3ho8Ycy3SZmNWqkwYKsgWVjWTD/v9Emp5Y8jL6eyW+2MrsOeKOaV38kOEcV/+aUJOMh3+m35V0yIgJZ+0XyVWYBAx6CHd1jPVYE3EMUHm6oOEqPHffVF3QUKr6IB8at5l/vNZbRCsDK81DwAz7jCFLC9M5aNSzIYZmZmi7ZtRU76leVDQ2E/OQqnap2JhCxKFKUCX25pCBMw4L5/egV7CNuzkDw+YMMdSJ9+hb5vd8DeKJVTGyLKoF0kVqQpJcntQPRTzEVBTv7GijYFVku9rwh2ss/ye9t0Jfo1HNesA9 [email protected]
PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}:'
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[red]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@Bodacious
Bodacious / README.md
Created June 28, 2012 13:16
A handy helper for showing loading cells in iOS Apps with Rubymotion

This is a work in progress...

Sexy: らにXン

@Bodacious
Bodacious / REAME.md
Created July 6, 2012 13:05
Transposing An Existing XCode Project to Rubymotion

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.

Timescale

For those of you looking to do the same, here are some stats that might help you estimate the time required and the costs

@Bodacious
Bodacious / base.rb
Created August 20, 2012 17:56
An "ActiveRecord" library for RubyMotion
module ActiveRecord
class Base
COLUMN_TYPES_MAPPING = {
:int => 'INTEGER',
:long => 'INTEGER',
:longLongInt => 'BIGINT',
:bool => 'BOOLEAN',
:double => 'DECIMAL',
@Bodacious
Bodacious / Rakefile
Created August 23, 2012 11:19
my Rakefile for lastest Rubymotion app
$:.unshift("/Library/RubyMotion/lib")
require File.join(File.dirname(__FILE__), 'version')
require 'motion/project'
require 'bundler'
Bundler.require
@Bodacious
Bodacious / README.md
Created September 21, 2012 09:06
What's in your RubyMotion project's Rakefile?

There's not a great deal of documentation on the options available when configuring your Rakefile in Rubymotion.

I figure having the community share what's in theirs will help other developers get a better idea of how they should configure their own project.