This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts ((1..100).map {|n| n**2}).inject{|sum, n| sum += n} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'tweetstream' | |
@statuses = [] | |
@keywords = {} | |
TweetStream::Client.new("MikeyMcTesty", "password9").track(ARGV) do |status, client| | |
statusText = status.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading development environment (Rails 3.0.1) | |
>> rs = ActionController::Routing::Routes | |
... tons of lines ... | |
>> puts rs.routes | |
ANY /(.:format) {:controller=>"conferences", :action=>"index"} | |
GET /conferences/:conference_id/events(.:format) {:controller=>"events", :action=>"index"} | |
POST /conferences/:conference_id/events(.:format) {:controller=>"events", :action=>"create"} | |
GET /conferences/:conference_id/events/new(.:format) {:controller=>"events", :action=>"new"} | |
GET /conferences/:conference_id/events/:id/edit(.:format) {:controller=>"events", :action=>"edit"} | |
GET /conferences/:conference_id/events/:id(.:format) {:controller=>"events", :action=>"show"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for(@event, :url => url_for(:controller => "events", :conference => @conference)) do |f| %> | |
<% if @event.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@event.errors.count, "error") %> prohibited this event from being saved:</h2> | |
<ul> | |
<% @event.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < ActiveRecord::Base | |
belongs_to :event, :foreign_key => :parent_event_id | |
has_many :events | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Xcode4/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project\ Templates/Application/Navigation-based\ Application/Navigation-based\ Core\ Data\ Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGFloat CGContextShadowOrientationYMultiplier() { | |
static CGFloat sharedMultiplier__ = 0.0; | |
if (sharedMultiplier__ == 0.0) { | |
// feel gross | |
CGFloat osVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; | |
sharedMultiplier__ = (osVersion < 3.2f) ? 1.0 : -1.0; | |
} | |
return sharedMultiplier__; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main() { | |
CGFloat version = [@"4.2.1" floatValue]; | |
NSLog(@"version: %f", version); | |
} | |
O2Machina:~ karl$ gcc main.m -o test -framework Foundation | |
O2Machina:~ karl$ ./test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importContents = open("...") | |
Time.zone = @timezone | |
events = ActiveSupport::JSON.decode(importContents) | |
newEvents = [] | |
events.each { |anEvent| | |
aEvent = Event.new( :title => anEvent["title"], | |
:event_type => anEvent["type"], | |
:description => anEvent["description"], | |
:location => anEvent["location"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"endTime" : "2/9/11 12:30 PM", | |
"id" : "1", | |
"location" : "Fandango", | |
"sessionEndTime" : "2/9/11 12:30 PM", | |
"sessionStartTime" : "2/9/11 9:30 AM", | |
"startTime" : "2/9/11 9:30 AM", | |
}, |
OlderNewer