It all comes back to connectivity. Om Malik (TWiST #327 @00:37:30) has a brilliant characterization of the true impact of the internet:
human emotion amplified at network scale
My occasional technical diary of thoughts, tips, and tools from some of the more interesting things I'm playing around with at the time. That means all things Cloud, Open Source, Rails, BigData, Mobile, or just my latest rant.. who knows!
human emotion amplified at network scale
# do a complete folder/file listing
session = Megar::Session.new(email: 'my@email.com', password: 'my_password')
session.folders.each do |folder|
folder.files.each do |file|
puts file.name
end
end
# upload a file
file_handle = '../my_files/was_called_this.mp3'
session.files.create( name: 'First.mp3', body: file_handle )Or from the command line:$ megar -e my@email.com -p my_password ls $ megar -e my@email.com -p my_password put *.pdfI would still call it "experimental" at this stage because it needs more widespread hammering, and of course the Mega API is not fully documented yet. There are many more features of the API that it would be good to support, and I'd love for others to pitch in and help - go fork it on github!
resource :inbox, :controller => 'inbox', :only => [:show,:create]And then in the controller we provide handler implementations for any of the 9 event types we wish to consume. Here's how we might get started handling inbound email, including pulling out the attachments:
class InboxController < ApplicationController
include Mandrill::Rails::WebHookProcessor
# Defines our handler for the "inbound" event type.
# This gets called for every inbound event sent from Mandrill.
def handle_inbound(event_payload)
[... do something with the event_payload here,
or stuff it on a background queue for later ... ]
if attachments = event_payload.attachments.presence
# yes, we have at least 1 attachment. Let's examine the first:
a1 = attachments.first
a1.name # => e.g. 'sample.pdf'
a1.type # => e.g. 'application/pdf'
a1.content
# => this is the raw content provided by Mandrill,
# and will be base64-encoded if not plain text
# e.g. 'JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvY ... (etc)'
a1.decoded_content
# => this is the content decoded by Mandrill::Rails,
# ready to be written as a File or whatever
# e.g. '%PDF-1.3\n%\xC4\xE5 ... (etc)'
end
end
endThat's nice and easy, yes? See the Mandrill::Rails Cookbook for more tips.$ mcs hello_world.cs $ mono hello_world.exe
{
"cmd": ["mcs","$file"],
"selector": "source.cs"
}Then when you are in a C# file you can simply ⌘B to compile. Like this:same but different!What I find more interesting is a comparison of the fundamental productivity patterns used in each community, assuming your goal is to produce high-quality code that can be reliably distributed or deployed, and likely makes liberal use of other - probably open source - code components.
Minimum 5 years experience in Ruby on Rails, html5, JQuery, Mongo DB, and building andriod and iphone/ipad apps
# config/initializers/mime_types.rb:
Mime::Type.register_alias "text/html", :mobile
# application_controller.rb:
class ApplicationController < ActionController::Base
before_filter { request.format = :mobile if (browser.iphone? || browser.android?) }
end
With that in place, my *.mobile.haml view and layout files just need to focus on rendering the mobile site..toolbar
%h1= t('.title')
%a.button.back.touch_load{'data-url' => menu_dashboard_path, 'data-transition' => 'pop-out' }= t(:done)
.content
= render :partial => 'notes/table'The enableSmartphonePageLoad function runs during page load to setup the behaviour: enableSmartphonePageLoad: function() {
$('.touch_load').live('click', function() {
var url = $(this).data('url') || $(this).attr('href');
var transition = $(this).data('transition') || 'slide-left';
if (url != "") {
jsTouch.loadPage(url, { transition: transition });
}
return false;
});
},