Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="draggable" style="width: 50px; float: left; height: 50px; background: red;">1</div>
<div class="draggable" style="width: 50px; float: left; height: 50px; border: 1px solid red;">2</div>
<div class="draggable" style="width: 50px; float: left; height: 50px; border: 1px solid red;">3</div>
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@nitsujw
nitsujw / Gemfile
Created March 18, 2012 02:46
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@nitsujw
nitsujw / application.rb
Created April 4, 2012 16:36 — forked from bradhe/application.rb
Generates a set of JavaScript functions that behave very similarly to Rails' named routes. Even plays nice with the assets pipeline.
module Sprockets::Helpers::RailsHelper
require File.join(Rails.root, "app", "helpers", "assets_helper.rb")
include AssetsHelper
end
@nitsujw
nitsujw / futures.rb
Created April 26, 2012 01:34 — forked from wycats/0_app.rb
Example of using a simple future library for parallel HTTP requests
require "thread"
class Future
attr_reader :exception, :cancelled
def initialize(&block)
@thread = Thread.new(&block)
@thread.abort_on_exception = false
@exception = nil
@cancelled = false
046dca3a09c346963ddf89277262c01ed071e89833b5dd8474466bfb7c99150494fd416de41238335440b30da8f4d47a3866a144674a8f21eda81c137407093171;effektz